-
Notifications
You must be signed in to change notification settings - Fork 177
Add support for protected conda environments #1058
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
Changes from 36 commits
181519f
3ec3015
1e59d8f
8150b81
7540633
c43f6bb
bfce427
285d8d8
5ea8513
596f10d
5d05eac
e3b8659
7509f2a
023f815
6ff480e
f4c092e
3255967
0a3acff
9196951
7e758da
adc94a4
9265135
c841a22
60b87bc
bee6aaf
a66bc0c
98ba9a4
f58bb03
60cf7ef
1e1efdf
d40f731
5bfd549
dc496d5
630d022
289cd07
84d9326
1e0b0b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # yaml-language-server: $schema=../../constructor/data/construct.schema.json | ||
| "$schema": "../../constructor/data/construct.schema.json" | ||
|
|
||
| name: ProtectedBaseEnv | ||
| version: X | ||
| installer_type: all | ||
|
|
||
| channels: | ||
| - defaults | ||
|
|
||
| specs: | ||
| - python | ||
| - conda | ||
|
|
||
| extra_envs: | ||
| default: | ||
| specs: | ||
| - python | ||
| - pip | ||
| - conda | ||
|
|
||
| extra_files: | ||
| - frozen.json: conda-meta/frozen | ||
|
Jrice1317 marked this conversation as resolved.
|
||
| - frozen.json: envs/default/conda-meta/frozen | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ### Enhancements | ||
|
|
||
| * Add support for installing [protected conda environments](https://conda.org/learn/ceps/cep-0022#specification). (#1058) | ||
|
|
||
| ### Bug fixes | ||
|
|
||
| * <news item> | ||
|
|
||
| ### Deprecations | ||
|
|
||
| * <news item> | ||
|
|
||
| ### Docs | ||
|
|
||
| * <news item> | ||
|
|
||
| ### Other | ||
|
|
||
| * <news item> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| from conda.models.version import VersionOrder as Version | ||
| from ruamel.yaml import YAML | ||
|
|
||
| from constructor.utils import StandaloneExe, identify_conda_exe | ||
| from constructor.utils import StandaloneExe, check_version, identify_conda_exe | ||
|
|
||
| if TYPE_CHECKING: | ||
| from collections.abc import Generator, Iterable | ||
|
|
@@ -317,6 +317,8 @@ def _run_installer( | |
| check=check_subprocess, | ||
| options=options, | ||
| ) | ||
| if request and ON_CI: | ||
| request.addfinalizer(lambda: shutil.rmtree(str(install_dir), ignore_errors=True)) | ||
|
Comment on lines
+320
to
+322
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we do this for all installers? Regardless, let's add a comment that we are doing this to free space and prevent "running out of storage" errors.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we uninstall by default on Windows, I'm not worried about EXE installers. PKG installers already have that finalizer. I did add a comment though. |
||
| elif installer.suffix == ".pkg": | ||
| if request and ON_CI: | ||
| request.addfinalizer(lambda: shutil.rmtree(str(install_dir), ignore_errors=True)) | ||
|
|
@@ -512,8 +514,7 @@ def test_example_mirrored_channels(tmp_path, request): | |
| @pytest.mark.xfail( | ||
| ( | ||
| CONDA_EXE == StandaloneExe.CONDA | ||
| and CONDA_EXE_VERSION is not None | ||
| and CONDA_EXE_VERSION < Version("23.11.0a0") | ||
| and not check_version(CONDA_EXE_VERSION, min_version="23.11.0a0") | ||
| ), | ||
| reason="Known issue with conda-standalone<=23.10: shortcuts are created but not removed.", | ||
| ) | ||
|
|
@@ -693,8 +694,7 @@ def test_example_scripts(tmp_path, request): | |
| @pytest.mark.skipif( | ||
| ( | ||
| CONDA_EXE == StandaloneExe.MAMBA | ||
| or CONDA_EXE_VERSION is None | ||
| or CONDA_EXE_VERSION < Version("23.11.0a0") | ||
| and not check_version(CONDA_EXE_VERSION, min_version="23.11.0a0") | ||
| ), | ||
| reason="menuinst v2 requires conda-standalone>=23.11.0; micromamba is not supported yet", | ||
| ) | ||
|
|
@@ -1218,7 +1218,7 @@ def _get_dacl_information(filepath: Path) -> dict: | |
|
|
||
|
|
||
| @pytest.mark.xfail( | ||
| CONDA_EXE == StandaloneExe.CONDA and CONDA_EXE_VERSION < Version("24.9.0"), | ||
| CONDA_EXE == StandaloneExe.CONDA and not check_version(CONDA_EXE_VERSION, min_version="24.9.0"), | ||
| reason="Pre-existing .condarc breaks installation", | ||
| ) | ||
| def test_ignore_condarc_files(tmp_path, monkeypatch, request): | ||
|
|
@@ -1268,7 +1268,7 @@ def test_ignore_condarc_files(tmp_path, monkeypatch, request): | |
|
|
||
|
|
||
| @pytest.mark.skipif( | ||
| CONDA_EXE == StandaloneExe.CONDA and CONDA_EXE_VERSION < Version("24.11.0"), | ||
| CONDA_EXE == StandaloneExe.CONDA and check_version(CONDA_EXE_VERSION, min_version="24.11.0"), | ||
| reason="Requires conda-standalone 24.11.x or newer", | ||
| ) | ||
| @pytest.mark.skipif(not sys.platform == "win32", reason="Windows only") | ||
|
|
@@ -1369,6 +1369,39 @@ def test_output_files(tmp_path): | |
| assert files_exist == [] | ||
|
|
||
|
|
||
| @pytest.mark.xfail( | ||
| condition=( | ||
| CONDA_EXE == StandaloneExe.CONDA | ||
| and check_version(CONDA_EXE_VERSION, min_version="25.5.0", max_version="25.7.0") | ||
| ), | ||
| reason="conda-standalone 25.5.x fails with protected environments", | ||
| strict=True, | ||
| ) | ||
| def test_frozen_environment(tmp_path, request): | ||
| input_path = _example_path("protected_base") | ||
| for installer, install_dir in create_installer(input_path, tmp_path): | ||
| _run_installer( | ||
| input_path, | ||
| installer, | ||
| install_dir, | ||
| request=request, | ||
| uninstall=False, | ||
| ) | ||
|
|
||
| expected_frozen_paths = { | ||
| install_dir / "conda-meta" / "frozen", | ||
| install_dir / "envs" / "default" / "conda-meta" / "frozen", | ||
| } | ||
|
|
||
| actual_frozen_paths = set() | ||
| for env in install_dir.glob("**/conda-meta/history"): | ||
| frozen_file = env.parent / "frozen" | ||
| if frozen_file.exists(): | ||
| actual_frozen_paths.add(frozen_file) | ||
|
marcoesters marked this conversation as resolved.
|
||
|
|
||
| assert expected_frozen_paths == actual_frozen_paths | ||
|
|
||
|
|
||
| def test_regressions(tmp_path, request): | ||
| input_path = _example_path("regressions") | ||
| for installer, install_dir in create_installer(input_path, tmp_path): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.