-
Notifications
You must be signed in to change notification settings - Fork 176
Provide metadata to easily protect environments #1149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add version check for frozen environments - Implement comprehensive testing for base and extra environments - Handle different datatypes for frozen file specifications - Add helper functions for version range validation
- Refine schema design for freeze_base and freeze_env - Add validation models to catch configuration errors early - Update examples and documentation - Separate base environment vs extra_env freezing logic
| } | ||
| ], | ||
| "default": null, | ||
| "description": "Same as `freeze_base`, but for this conda environment.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"but for this conda environment", does this mean the same thing as "for the currently activated conda environment"?
lrandersson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
|
|
||
|
|
||
| # Validate frozen environments | ||
| def validate_frozen_envs(info, exe_type, exe_version) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we annotate the types for info, exe_type, exe_version?
| - Conda-standalone version if frozen environments exist | ||
| """ | ||
|
|
||
| def get_frozen_env(path) -> str | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def get_frozen_env(path) -> str | None: | |
| def get_frozen_env(path: str) -> str | None: |
(I'm assuming it's of type str so feel free to ignore)
|
|
||
| # Collect environments using freeze_base/freeze_env | ||
| frozen_envs = set() | ||
| if info.get("freeze_base", {}).get("conda") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any risk here that info.get("freeze_base", {}).get("conda") evaluates to an empty string and results in follow-up errors?
| sys.exit( | ||
| "Error: conda-standalone 25.5.x has known issues with frozen environments. " | ||
| "Please use conda-standalone 25.7.0 or newer." | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a sys.exit call instead of an exception?
| fh.write("\n".join(builder)) | ||
|
|
||
|
|
||
| def write_frozen(freeze_info, dst_dir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any type annotations needed?
| if os.path.exists(join(tmp_dir, "conda-meta", "frozen")): | ||
| post_t.add(join(tmp_dir, "conda-meta", "frozen"), "conda-meta/frozen") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this PR is in draft 1063 I'd suggest we also use pathlib here if possible (same for below).
| @@ -0,0 +1,19 @@ | |||
| ### Enhancements | |||
|
|
|||
| * Add support for installing [protected conda environments](https://conda.org/learn/ceps/cep-0022#specification). (#1149) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Add support for installing [protected conda environments](https://conda.org/learn/ceps/cep-0022#specification). (#1149) | |
| * Add support for installing [protected (frozen) conda environments](https://conda.org/learn/ceps/cep-0022#specification). (#1149) |
Perhaps it would be good to expose wording frozen that we use for the feature. Feel free to ignore this.
Description
Overview
This PR adds frozen environment metadata support across all installer types, enabling users to easily protect their environments.
Changes
Related Links
https://conda.org/learn/ceps/cep-0022/
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?