From 03b887292ae0df86ab658abd37aaa7e0d605ed27 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 30 Sep 2024 17:06:33 +0200 Subject: [PATCH] Constrain dependencies in installer's base env more strictly (#187) * Fix base env dependencies * add more tests * pin in the napari env too * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Do not pin mamba --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/make_bundle_conda.yml | 9 +++++++++ build_installers.py | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/make_bundle_conda.yml b/.github/workflows/make_bundle_conda.yml index 80e3f831..4c191bcf 100644 --- a/.github/workflows/make_bundle_conda.yml +++ b/.github/workflows/make_bundle_conda.yml @@ -547,8 +547,11 @@ jobs: bash napari-${{ env.version }}-${{ runner.os }}-${{ env.arch-suffix }}.${{ env.extension }} -bfp "${{ runner.temp }}/napari-${{ env.version }}" . "${{ runner.temp }}/napari-${{ env.version }}/etc/profile.d/conda.sh" conda activate "${{ runner.temp }}/napari-${{ env.version }}/envs/napari-${{ env.version }}" + conda info conda config --show-sources conda config --show + conda list -p "${{ runner.temp }}/napari-${{ env.version }}" + conda list -p "${{ runner.temp }}/napari-${{ env.version }}/envs/napari-${{ env.version }}" xvfb-run --auto-servernum napari --info # Test shortcut python -c "import pathlib as p; assert list(p.Path('~/.local/share/applications/').expanduser().glob('napari*.desktop'))" @@ -563,8 +566,11 @@ jobs: installer -pkg napari-${{ env.version }}-${{ runner.os }}-${{ env.arch-suffix }}.${{ env.extension }} -target CurrentUserHomeDirectory -dumplog . "/Users/runner/Library/napari-${{ env.version }}/etc/profile.d/conda.sh" conda activate "/Users/runner/Library/napari-${{ env.version }}/envs/napari-${{ env.version }}" + conda info conda config --show-sources conda config --show + conda list -p "/Users/runner/Library/napari-${{ env.version }}" + conda list -p "/Users/runner/Library/napari-${{ env.version }}/envs/napari-${{ env.version }}" napari --info # Test shortcut python -c "import pathlib as p; assert list(p.Path('~/Applications').expanduser().glob('napari*.app'))" @@ -578,8 +584,11 @@ jobs: run: | cmd.exe /c start /wait napari-${{ env.version }}-${{ runner.os }}-${{ env.arch-suffix }}.${{ env.extension }} /S /D=${{ runner.temp }}\napari-${{ env.version }} CALL ${{ runner.temp }}\napari-${{ env.version }}\Scripts\activate ${{ runner.temp }}\napari-${{ env.version }}\envs\napari-${{ env.version }} + CALL conda info CALL conda config --show-sources CALL conda config --show + CALL conda list -p ${{ runner.temp }}\napari-${{ env.version }} + CALL conda list -p ${{ runner.temp }}\napari-${{ env.version }}\envs\napari-${{ env.version }} napari --info :: Test shortcut python -c "import pathlib as p; assert list(p.Path('%PROGRAMDATA%\\Microsoft\\Windows\\Start Menu\\Programs').glob('napari*\\napari*.lnk'))" diff --git a/build_installers.py b/build_installers.py index 75b2d67e..8a7e52ab 100644 --- a/build_installers.py +++ b/build_installers.py @@ -99,6 +99,13 @@ else: raise RuntimeError(f"Unrecognized OS: {sys.platform}") +CONDA_TOOL_DEPS = ( + "conda >=23.10", + "conda-libmamba-solver", + "mamba", + "pip", +) + def _use_local(): """ @@ -215,9 +222,7 @@ def _base_env(python_version=PY_VER): ], "specs": [ f"python={python_version}.*=*_cpython", - "conda", - "mamba", - "pip", + *CONDA_TOOL_DEPS, ], } @@ -237,11 +242,9 @@ def _napari_env( f"napari-menu={napari_version}", "napari-plugin-manager", f"pyside2={pyside_version}", - "conda", - "mamba", - "pip", - ] - + (extra_specs or []), + *CONDA_TOOL_DEPS, + *(extra_specs or ()), + ], # "exclude": exclude, # TODO: not supported yet in constructor }