From 42e6fbb673da299158c71f97c94180073212459a Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Tue, 17 Jun 2025 15:43:36 -0500 Subject: [PATCH 1/4] git subrepo pull --remote=https://github.com/ccordoba12/envs-manager.git --branch=download-exec --update --force external-deps/envs-manager subrepo: subdir: "external-deps/envs-manager" merged: "1038742" upstream: origin: "https://github.com/ccordoba12/envs-manager.git" branch: "download-exec" commit: "1038742" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- .../.github/workflows/linux-tests.yml | 10 -- .../.github/workflows/macos-tests.yml | 10 -- .../.github/workflows/windows-tests.yml | 12 --- external-deps/envs-manager/.gitrepo | 8 +- .../envs-manager/envs_manager/backends/api.py | 21 ++++- .../backends/conda_like_interface.py | 93 +++++++++++++++++-- .../envs_manager/backends/pixi_interface.py | 59 ++++++++++-- .../envs-manager/envs_manager/cli.py | 11 +-- .../envs-manager/envs_manager/manager.py | 18 ++-- .../envs_manager/tests/test_cli.py | 10 -- .../envs_manager/tests/test_manager.py | 44 ++++----- 11 files changed, 190 insertions(+), 106 deletions(-) diff --git a/external-deps/envs-manager/.github/workflows/linux-tests.yml b/external-deps/envs-manager/.github/workflows/linux-tests.yml index 3f626bd..52e1f4f 100644 --- a/external-deps/envs-manager/.github/workflows/linux-tests.yml +++ b/external-deps/envs-manager/.github/workflows/linux-tests.yml @@ -29,16 +29,6 @@ jobs: python-version: ${{ matrix.python-version }} environment-file: requirements/environment.yml auto-activate-base: false - - name: Install Micromamba and setup as executable backend - shell: bash -l {0} - run: | - curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.5.10 | tar -xvj bin/micromamba - echo "ENV_BACKEND_EXECUTABLE=${{ github.workspace }}/bin/micromamba" >> $GITHUB_ENV - - name: Install Pixi - shell: bash -l {0} - run: | - # This script installs Pixi in ~/.pixi/bin - curl -fsSL https://pixi.sh/install.sh | sh - name: Install envs-manager shell: bash -l {0} run: | diff --git a/external-deps/envs-manager/.github/workflows/macos-tests.yml b/external-deps/envs-manager/.github/workflows/macos-tests.yml index 4c07659..7897c06 100644 --- a/external-deps/envs-manager/.github/workflows/macos-tests.yml +++ b/external-deps/envs-manager/.github/workflows/macos-tests.yml @@ -29,16 +29,6 @@ jobs: python-version: ${{ matrix.python-version }} environment-file: requirements/environment.yml auto-activate-base: false - - name: Install Micromamba and setup as executable backend - shell: bash -l {0} - run: | - curl -Ls https://micro.mamba.pm/api/micromamba/osx-64/1.5.10 | tar -xvj bin/micromamba - echo "ENV_BACKEND_EXECUTABLE=${{ github.workspace }}/bin/micromamba" >> $GITHUB_ENV - - name: Install Pixi - shell: bash -l {0} - run: | - # This script installs Pixi in ~/.pixi/bin - curl -fsSL https://pixi.sh/install.sh | sh - name: Install envs-manager shell: bash -l {0} run: | diff --git a/external-deps/envs-manager/.github/workflows/windows-tests.yml b/external-deps/envs-manager/.github/workflows/windows-tests.yml index d5393a8..ae10733 100644 --- a/external-deps/envs-manager/.github/workflows/windows-tests.yml +++ b/external-deps/envs-manager/.github/workflows/windows-tests.yml @@ -29,18 +29,6 @@ jobs: python-version: ${{ matrix.python-version }} environment-file: requirements/environment.yml auto-activate-base: false - - name: Install Micromamba and setup as executable backend - shell: bash -l {0} - run: | - mkdir micromamba - curl -Ls https://micro.mamba.pm/api/micromamba/win-64/1.5.10 | tar -xvj -C micromamba - echo "ENV_BACKEND_EXECUTABLE=${{ github.workspace }}\micromamba\Library\bin\micromamba.exe" >> $GITHUB_ENV - echo "MAMBA_ROOT_PREFIX=${{ github.workspace }}\micromamba" >> $GITHUB_ENV - - name: Install Pixi - shell: bash -l {0} - run: | - # This script installs Pixi in ~/.pixi/bin - curl -fsSL https://pixi.sh/install.sh | sh - name: Install envs-manager shell: bash -l {0} run: | diff --git a/external-deps/envs-manager/.gitrepo b/external-deps/envs-manager/.gitrepo index 4cd109c..0f91c13 100644 --- a/external-deps/envs-manager/.gitrepo +++ b/external-deps/envs-manager/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/spyder-ide/env-manager.git - branch = main - commit = ca869c2606e09a598bdea54523b6f27c2c1019a6 - parent = 04f164242dda68164eab3072708eb9931b1da552 + remote = https://github.com/ccordoba12/envs-manager.git + branch = download-exec + commit = 1038742818f791248adbf682529ab2ef23e234c1 + parent = e61abd69a776795ce08f520cf65f6250e29d48cb method = merge cmdver = 0.4.9 diff --git a/external-deps/envs-manager/envs_manager/backends/api.py b/external-deps/envs-manager/envs_manager/backends/api.py index 14f9a25..39c1f89 100644 --- a/external-deps/envs-manager/envs_manager/backends/api.py +++ b/external-deps/envs-manager/envs_manager/backends/api.py @@ -3,6 +3,8 @@ # SPDX-License-Identifier: MIT from __future__ import annotations + +from pathlib import Path import subprocess from typing import TypedDict @@ -100,11 +102,12 @@ def __init__( self, environment_path: str, envs_directory: str, - external_executable: str | None = None, + bin_directory: str, ): self.environment_path = environment_path self.envs_directory = envs_directory - self.external_executable = external_executable + self.bin_directory = bin_directory + self.external_executable = None self.executable_variant = None assert self.validate(), f"{self.ID} backend unavailable!" @@ -115,6 +118,20 @@ def python_executable_path(self) -> str: def validate(self) -> bool: pass + def find_backend_executable(self, exec_name: str): + """Return the backend executable in bin_directory, if available.""" + cmd_list = [exec_name, f"{exec_name}.exe"] + for cmd in cmd_list: + path = Path(self.bin_directory) / cmd + if path.exists(): + return str(path) + + return + + def install_backend_executable(self): + """Install the backend executable in bin_directory.""" + raise NotImplementedError + def create_environment( self, packages: list[str] | None = None, diff --git a/external-deps/envs-manager/envs_manager/backends/conda_like_interface.py b/external-deps/envs-manager/envs_manager/backends/conda_like_interface.py index 0adb1cf..80588fc 100644 --- a/external-deps/envs-manager/envs_manager/backends/conda_like_interface.py +++ b/external-deps/envs-manager/envs_manager/backends/conda_like_interface.py @@ -6,10 +6,14 @@ import logging import os from pathlib import Path +import platform import shutil import subprocess +import sys +import tarfile from packaging.version import parse +import requests import yaml from envs_manager.backends.api import ( @@ -29,6 +33,12 @@ class CondaLikeInterface(BackendInstance): ID = "conda-like" + def __init__(self, environment_path, envs_directory, bin_directory): + super().__init__(environment_path, envs_directory, bin_directory) + + # This is needed for Micromamba + os.environ["MAMBA_ROOT_PREFIX"] = str(Path(self.envs_directory).parent) + @property def python_executable_path(self): if os.name == "nt": @@ -39,15 +49,13 @@ def python_executable_path(self): return str(python_executable_path) def validate(self): - if self.external_executable is None: - if os.name == "nt": - cmd_list = ["conda.exe", "conda.bat", "mamba.exe", "micromamba.exe"] - else: - cmd_list = ["conda", "mamba", "micromamba"] + self.external_executable = self.find_backend_executable(exec_name="micromamba") - for cmd in cmd_list: - if shutil.which(cmd): - self.external_executable = shutil.which(cmd) + if self.external_executable is None: + self.install_backend_executable() + self.external_executable = self.find_backend_executable( + exec_name="micromamba" + ) if self.external_executable: command = [self.external_executable, "--version"] @@ -69,8 +77,77 @@ def validate(self): return True except Exception as error: logger.error(error.stderr) + return False + def install_backend_executable(self): + # OS route for the Micromamba URL + machine = platform.machine() + if os.name == "nt": + os_route = "win-64" + elif sys.platform == "darwin": + if machine == "arm64" or machine == "aarch64": + os_route = "osx-arm64" + else: + os_route = "osx-64" + else: + if machine == "x86_64": + os_route = "linux-64" + elif machine == "aarch64": + os_route = "linux-aarch64" + else: + os_route = "linux-ppc64le" + + # Download compressed Micromamba file + bin_directory_as_path = Path(self.bin_directory) + compressed_file = "micromamba.tar.bz2" + path_to_compressed_file = bin_directory_as_path / compressed_file + + req = requests.get(f"https://micro.mamba.pm/api/micromamba/{os_route}/1.5.10") + with open(path_to_compressed_file, "wb") as f: + f.write(req.content) + + # Extract micromamba from compressed file + with tarfile.open(path_to_compressed_file, "r:bz2") as tar: + tar.extractall(path=self.bin_directory) + + # Move micromamba to the location we need + exec_extension = ".exe" if os.name == "nt" else "" + end_path = ( + bin_directory_as_path / "Library" / "bin" / "micromamba.exe" + if os.name == "nt" + else bin_directory_as_path / "bin" / "micromamba" + ) + shutil.move(end_path, bin_directory_as_path / f"micromamba{exec_extension}") + + # On Windows we also need the VS14 runtime because micromamba is linked against + # it + if os.name == "nt": + path_to_compressed_vs_runtime = ( + "vs2015_runtime-14.28.29325-h8ebdc22_9.tar.bz2" + ) + req = requests.get( + f"https://anaconda.org/conda-forge/vs2015_runtime/14.28.29325/download/" + f"win-64/{path_to_compressed_vs_runtime}" + ) + with open(path_to_compressed_vs_runtime, "wb") as f: + f.write(req.content) + + with tarfile.open(path_to_compressed_vs_runtime, "r:bz2") as tar: + tar.extractall(path=self.bin_directory) + + # Clean up + try: + os.remove(path_to_compressed_file) + shutil.rmtree(bin_directory_as_path / "info") + if os.name == "nt": + os.remove(path_to_compressed_vs_runtime) + shutil.rmtree(bin_directory_as_path / "Library") + else: + shutil.rmtree(bin_directory_as_path / "bin") + except Exception: + pass + def create_environment(self, packages=None, channels=None, force=False): command = [self.external_executable, "create", "-p", self.environment_path] diff --git a/external-deps/envs-manager/envs_manager/backends/pixi_interface.py b/external-deps/envs-manager/envs_manager/backends/pixi_interface.py index e4a386f..06553ad 100644 --- a/external-deps/envs-manager/envs_manager/backends/pixi_interface.py +++ b/external-deps/envs-manager/envs_manager/backends/pixi_interface.py @@ -6,12 +6,12 @@ import logging import os from pathlib import Path -import shutil import subprocess import zipfile from packaging.version import parse from rattler import AboutJson +import requests from envs_manager.backends.api import BackendInstance, BackendActionResult, run_command @@ -22,8 +22,8 @@ class PixiInterface(BackendInstance): ID = "pixi" - def __init__(self, environment_path, envs_directory, external_executable=None): - super().__init__(environment_path, envs_directory, external_executable) + def __init__(self, environment_path, envs_directory, bin_directory): + super().__init__(environment_path, envs_directory, bin_directory) # We use this to save the Pixi packages cache directory self._cache_dir = None @@ -44,11 +44,11 @@ def python_executable_path(self): return str(python_executable_path) def validate(self): + self.external_executable = self.find_backend_executable(exec_name="pixi") + if self.external_executable is None: - cmd_list = ["pixi", "pixi.exe"] - for cmd in cmd_list: - if shutil.which(cmd): - self.external_executable = shutil.which(cmd) + self.install_backend_executable() + self.external_executable = self.find_backend_executable(exec_name="pixi") if self.external_executable: command = [self.external_executable, "--version"] @@ -64,6 +64,51 @@ def validate(self): return False + def install_backend_executable(self): + install_script = f"install{'.ps1' if os.name == 'nt' else '.sh'}" + path_to_install_script = Path(self.bin_directory) / install_script + + # Download script to install Pixi + req = requests.get(f"https://pixi.sh/{install_script}") + with open(str(path_to_install_script), "w") as f: + f.write(req.text) + + # Env vars to control how Pixi is installed + env = os.environ.copy() + env["PIXI_HOME"] = str(Path(self.bin_directory).parent) + env["PIXI_NO_PATH_UPDATE"] = "true" + + # Install Pixi + if os.name == "nt": + install_command = [ + "powershell.exe", + "-ExecutionPolicy", + "Bypass", + "-File", + str(path_to_install_script), + ] + else: + install_command = ["sh", install_script] + + try: + run_command( + install_command, + run_env=env, + cwd=self.bin_directory, + ) + except subprocess.CalledProcessError as error: + logger.error(error.stderr.strip()) + return + except Exception as error: + logger.error(error, exc_info=True) + return + + # Cleanup + try: + os.remove(path_to_install_script) + except Exception: + pass + def create_environment(self, packages=None, channels=None, force=False): # We need to run `pixi init` first init_command = [ diff --git a/external-deps/envs-manager/envs_manager/cli.py b/external-deps/envs-manager/envs_manager/cli.py index 049af0b..02b8add 100644 --- a/external-deps/envs-manager/envs_manager/cli.py +++ b/external-deps/envs-manager/envs_manager/cli.py @@ -6,12 +6,7 @@ import logging import sys -from envs_manager.manager import ( - DEFAULT_BACKENDS_ROOT_PATH, - DEFAULT_BACKEND, - EXTERNAL_EXECUTABLE, - Manager, -) +from envs_manager.manager import DEFAULT_BACKENDS_ROOT_PATH, DEFAULT_BACKEND, Manager def main(args=None): @@ -167,14 +162,12 @@ def main(args=None): logger.debug(options) logger.debug(f"Using BACKENDS_ROOT_PATH: {DEFAULT_BACKENDS_ROOT_PATH}") logger.debug(f"Using ENV_BACKEND: {options.backend}") - logger.debug(f"Using ENV_BACKEND_EXECUTABLE: {EXTERNAL_EXECUTABLE}") if options.env_name: manager = Manager( backend=options.backend, env_name=options.env_name, root_path=DEFAULT_BACKENDS_ROOT_PATH, - external_executable=EXTERNAL_EXECUTABLE, ) if options.command == "create": manager.create_environment( @@ -205,5 +198,5 @@ def main(args=None): else: backend = DEFAULT_BACKEND - manager = Manager(backend=backend, external_executable=EXTERNAL_EXECUTABLE) + manager = Manager(backend=backend) manager.list_environments() diff --git a/external-deps/envs-manager/envs_manager/manager.py b/external-deps/envs-manager/envs_manager/manager.py index 4159d69..c155522 100644 --- a/external-deps/envs-manager/envs_manager/manager.py +++ b/external-deps/envs-manager/envs_manager/manager.py @@ -20,7 +20,6 @@ ) DEFAULT_BACKEND = os.environ.get("ENV_BACKEND", "venv") DEFAULT_ENVS_ROOT_PATH = DEFAULT_BACKENDS_ROOT_PATH / DEFAULT_BACKEND / "envs" -EXTERNAL_EXECUTABLE = os.environ.get("ENV_BACKEND_EXECUTABLE", None) class ManagerActions: @@ -57,9 +56,6 @@ class ManagerOptions(TypedDict): env_directory: str | None """Path to the environment's directory.""" - external_executable: str | None - """Path to the external executable that will be used by the manager.""" - class ManagerActionResult(BackendActionResult): """Dictionary to report the result of a manager's action.""" @@ -85,17 +81,20 @@ def __init__( root_path: str | Path | None = None, env_name: str | None = None, env_directory: str | Path | None = None, - external_executable: str | Path | None = None, ): self.backend_class = self.BACKENDS[backend] self.env_name = env_name self.root_path = DEFAULT_BACKENDS_ROOT_PATH if root_path is None else root_path - external_executable = ( - str(external_executable) if external_executable is not None else None - ) + + # This where the backend executable will be saved + bin_directory = Path(self.root_path) / backend / "bin" + if not bin_directory.exists(): + bin_directory.mkdir(parents=True) # This is where the environments for the given backend will be saved backend_envs_directory = Path(self.root_path) / backend / "envs" + if not backend_envs_directory.exists(): + backend_envs_directory.mkdir() if env_directory: self.env_directory = Path(env_directory) @@ -108,7 +107,7 @@ def __init__( self.backend_instance: BackendInstance = self.backend_class( str(self.env_directory), str(backend_envs_directory), - external_executable=external_executable, + str(bin_directory), ) self._manager_options = ManagerOptions( @@ -116,7 +115,6 @@ def __init__( root_path=str(root_path), env_name=env_name, env_directory=str(self.env_directory), - external_executable=external_executable, ) def run_action(self, action: ManagerActions, action_options: dict | None = None): diff --git a/external-deps/envs-manager/envs_manager/tests/test_cli.py b/external-deps/envs-manager/envs_manager/tests/test_cli.py index 457b894..58f728f 100644 --- a/external-deps/envs-manager/envs_manager/tests/test_cli.py +++ b/external-deps/envs-manager/envs_manager/tests/test_cli.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: MIT import os -from pathlib import Path import subprocess import pytest @@ -69,19 +68,12 @@ def test_cli(tmp_path, backend): backends_root_path.mkdir(parents=True) os.environ["BACKENDS_ROOT_PATH"] = str(backends_root_path) - env = os.environ.copy() - if backend_value == "pixi": - env["ENV_BACKEND_EXECUTABLE"] = str( - Path(env.get("HOME")) / ".pixi" / "bin" / "pixi" - ) - # Check environment creation create_output = subprocess.check_output( " ".join( ["envs-manager", f"-b={backend_value}", f"-e={list_env_result}", "create"] ), shell=True, - env=env, ) assert any( [ @@ -101,7 +93,6 @@ def test_cli(tmp_path, backend): ] ), shell=True, - env=env, ) assert f"Using ENV_BACKEND: {backend_value}" not in str(list_env_output) assert list_env_result in str(list_env_output) @@ -118,7 +109,6 @@ def test_cli(tmp_path, backend): ] ), shell=True, - env=env, ) assert f"Using ENV_BACKEND: {backend_value}" in str(list_env_packages) assert package_list_env_result in str(list_env_packages) diff --git a/external-deps/envs-manager/envs_manager/tests/test_manager.py b/external-deps/envs-manager/envs_manager/tests/test_manager.py index 7fca1c9..e2e833f 100644 --- a/external-deps/envs-manager/envs_manager/tests/test_manager.py +++ b/external-deps/envs-manager/envs_manager/tests/test_manager.py @@ -22,17 +22,16 @@ ENV_FILES_CONDA_LIKE = ENV_FILES / "conda-like-files" ENV_FILES_PIXI = ENV_FILES / "pixi-files" ENV_FILES_VENV = ENV_FILES / "venv-files" -PIXI_EXECUTABLE = Path(os.environ.get("HOME")) / ".pixi" / "bin" / "pixi" MANAGER_BACKENDS_SETUP = [ - ("pixi", PIXI_EXECUTABLE, None), - ("conda-like", os.environ.get("ENV_BACKEND_EXECUTABLE"), None), - ("venv", None, None), + ("pixi", None), + ("conda-like", None), + ("venv", None), ] BACKENDS = [ ( - ("pixi", PIXI_EXECUTABLE, None), + ("pixi", None), "python", ["packaging=21.0"], ["packaging"], @@ -56,7 +55,7 @@ ], ), ( - ("pixi", PIXI_EXECUTABLE, "test_env"), + ("pixi", "test_env"), "python", ["packaging=21.0"], ["packaging"], @@ -80,7 +79,7 @@ ], ), ( - ("venv", None, None), + ("venv", None), "pip", ["packaging==21.0"], ["packaging"], @@ -94,7 +93,7 @@ [2, 1, 6, "The PyPA recommended tool for installing Python packages."], ), ( - ("venv", None, "test_env"), + ("venv", "test_env"), "pip", ["packaging==21.0"], ["packaging"], @@ -108,7 +107,7 @@ [2, 1, 6, "The PyPA recommended tool for installing Python packages."], ), ( - ("conda-like", os.environ.get("ENV_BACKEND_EXECUTABLE"), None), + ("conda-like", None), "python", ["packaging=21.0"], ["packaging"], @@ -126,7 +125,7 @@ [2, 1, 6, "General purpose programming language"], ), ( - ("conda-like", os.environ.get("ENV_BACKEND_EXECUTABLE"), "test_env"), + ("conda-like", "test_env"), "python", ["packaging=21.0"], ["packaging"], @@ -158,27 +157,27 @@ IMPORT_EXPORT_BACKENDS = [ ( - ("pixi", PIXI_EXECUTABLE, None), + ("pixi", None), str(ENV_FILES_PIXI / "pixi_import_env.zip"), str(ENV_FILES_PIXI / "pixi_export_env.zip"), ), ( - ("pixi", PIXI_EXECUTABLE, "test_env"), + ("pixi", "test_env"), str(ENV_FILES_PIXI / "pixi_import_env.zip"), str(ENV_FILES_PIXI / "pixi_export_env.zip"), ), ( - ("venv", None, None), + ("venv", None), str(ENV_FILES_VENV / "venv_import_env.txt"), str(ENV_FILES_VENV / "venv_export_env.txt"), ), ( - ("venv", None, "test_env"), + ("venv", "test_env"), str(ENV_FILES_VENV / "venv_import_env.txt"), str(ENV_FILES_VENV / "venv_export_env.txt"), ), ( - ("conda-like", os.environ.get("ENV_BACKEND_EXECUTABLE"), None), + ("conda-like", None), str( ENV_FILES_CONDA_LIKE / f"{BASE_IMPORT_EXPORT_FILENAME}_conda_import_env.yml" ), @@ -187,7 +186,7 @@ ), ), ( - ("conda-like", os.environ.get("ENV_BACKEND_EXECUTABLE"), "test_env"), + ("conda-like", "test_env"), str( ENV_FILES_CONDA_LIKE / f"{BASE_IMPORT_EXPORT_FILENAME}_conda_import_env.yml" ), @@ -235,7 +234,8 @@ def check_packages(manager_instance, package, version): @pytest.fixture def manager_instance(request, tmp_path): - backend, executable, env_name = request.param + backend, env_name = request.param + if not env_name: # Passing full env directory root_path = None @@ -251,7 +251,6 @@ def manager_instance(request, tmp_path): root_path=root_path, env_name=env_name, env_directory=env_directory, - external_executable=executable, ) yield manager_instance @@ -420,12 +419,9 @@ def test_manager_backends( def test_manager_backends_import_export( manager_instance, initial_import_path, expected_export_path, tmp_path, capsys ): - # This test fails on Mac when using conda. It seems that's due to an error in conda - # because it passes with micromamba. - if ( - sys.platform == "darwin" - and "conda" in os.environ.get("ENV_BACKEND_EXECUTABLE") - and isinstance(manager_instance.backend_instance, CondaLikeInterface) + # This test fails on Mac when using micromamba. + if sys.platform == "darwin" and isinstance( + manager_instance.backend_instance, CondaLikeInterface ): return From e293f9b1b4adec036038448ba670278e643b20af Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Tue, 17 Jun 2025 15:52:42 -0500 Subject: [PATCH 2/4] Remove option to set a Pixi executable - That's no longer necessary because envs-manager will be in charge of downloading and installing Pixi. That way we'll have better control over how and where we install Pixi. - Also, make some adjustments due to the changes done in envs-manager --- spyder_env_manager/spyder/config.py | 21 +------------------ spyder_env_manager/spyder/confpage.py | 10 --------- spyder_env_manager/spyder/plugin.py | 11 ---------- .../spyder/widgets/main_widget.py | 3 --- spyder_env_manager/spyder/workers.py | 3 --- 5 files changed, 1 insertion(+), 47 deletions(-) diff --git a/spyder_env_manager/spyder/config.py b/spyder_env_manager/spyder/config.py index ae83b59..6694249 100644 --- a/spyder_env_manager/spyder/config.py +++ b/spyder_env_manager/spyder/config.py @@ -9,25 +9,7 @@ """Spyder Env Manager default configuration.""" # Third-party imports -from envs_manager.manager import ( - DEFAULT_BACKENDS_ROOT_PATH, - EXTERNAL_EXECUTABLE, -) - -# Spyder and local imports -from spyder.utils.conda import find_pixi - - -def pixi_executable(): - """ - Get default value for pixi executable. - - This is the path for Pixi executable file. - """ - pixi_executable = EXTERNAL_EXECUTABLE - if not pixi_executable: - pixi_executable = find_pixi() - return pixi_executable +from envs_manager.manager import DEFAULT_BACKENDS_ROOT_PATH CONF_SECTION = "spyder_env_manager" @@ -35,7 +17,6 @@ def pixi_executable(): ( CONF_SECTION, { - "pixi_file_executable_path": pixi_executable(), "environments_path": str(DEFAULT_BACKENDS_ROOT_PATH), "selected_environment": "", "exclude_dependency_action": True, diff --git a/spyder_env_manager/spyder/confpage.py b/spyder_env_manager/spyder/confpage.py index e6cb39f..04cf5df 100644 --- a/spyder_env_manager/spyder/confpage.py +++ b/spyder_env_manager/spyder/confpage.py @@ -25,14 +25,6 @@ class SpyderEnvManagerConfigPage(PluginConfigPage): # ------------------------------------------------------------------------ def setup_page(self): paths_group = QGroupBox(_("Paths")) - pixi_path_label = QLabel(_("Pixi executable:")) - pixi_path_label.setToolTip(_("Path to the Pixi executable")) - pixi_path_label.setWordWrap(True) - - pixi_path = QLabel(self.get_option("pixi_file_executable_path", None)) - pixi_path.setTextInteractionFlags(Qt.TextSelectableByMouse) - pixi_path.setWordWrap(True) - environments_path_label = QLabel(_("Root directory for environments location:")) environments_path_label.setToolTip( _( @@ -47,8 +39,6 @@ def setup_page(self): environments_path.setWordWrap(True) paths_layout = QVBoxLayout() - paths_layout.addWidget(pixi_path_label) - paths_layout.addWidget(pixi_path) paths_layout.addWidget(environments_path_label) paths_layout.addWidget(environments_path) paths_group.setLayout(paths_layout) diff --git a/spyder_env_manager/spyder/plugin.py b/spyder_env_manager/spyder/plugin.py index d942f5f..3527263 100644 --- a/spyder_env_manager/spyder/plugin.py +++ b/spyder_env_manager/spyder/plugin.py @@ -8,9 +8,6 @@ Spyder Env Manager Plugin. """ -# Standard library imports -from pathlib import Path - # Third-party imports import qtawesome as qta from qtpy.QtCore import Signal @@ -104,14 +101,6 @@ def on_preferences_teardown(self): def on_maininterpreter_teardown(self): self.sig_set_spyder_custom_interpreter.disconnect() - def check_compatibility(self): - message = "" - pixi_executable_path = self.get_conf("pixi_file_executable_path") - valid = pixi_executable_path and Path(pixi_executable_path).exists() - if not valid: - message = _("Unable to find the Pixi executable!") - return valid, message - def on_close(self, cancellable=True): return True diff --git a/spyder_env_manager/spyder/widgets/main_widget.py b/spyder_env_manager/spyder/widgets/main_widget.py index d6df515..21cce75 100644 --- a/spyder_env_manager/spyder/widgets/main_widget.py +++ b/spyder_env_manager/spyder/widgets/main_widget.py @@ -515,12 +515,10 @@ def _environment_as_custom_interpreter(self, environment_path: str | None = None if not environment_path: return - external_executable = self.get_conf("pixi_file_executable_path") backend = PixiInterface.ID manager = Manager( backend, env_directory=environment_path, - external_executable=external_executable, ) self.sig_set_spyder_custom_interpreter.emit( @@ -610,7 +608,6 @@ def _after_import_environment( backend=manager_options["backend"], root_path=manager_options["root_path"], env_name=manager_options["env_name"], - external_executable=manager_options["external_executable"], ), action=ManagerActions.InstallPackages, action_options=dict( diff --git a/spyder_env_manager/spyder/workers.py b/spyder_env_manager/spyder/workers.py index d64ab42..1722eaa 100644 --- a/spyder_env_manager/spyder/workers.py +++ b/spyder_env_manager/spyder/workers.py @@ -54,9 +54,6 @@ def __init__(self, parent, request: ManagerRequest): manager_options = request["manager_options"] manager_options["root_path"] = self.get_conf("environments_path") - manager_options["external_executable"] = self.get_conf( - "pixi_file_executable_path" - ) self.manager = Manager(**manager_options) self.manager_action = request["action"] From 0ff6c95ab1b65e285ecfcd2d413593b3e8b5fc80 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Tue, 17 Jun 2025 16:00:41 -0500 Subject: [PATCH 3/4] Remove Pixi installation on CIs --- .github/workflows/linux-tests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/linux-tests.yml b/.github/workflows/linux-tests.yml index 486d92f..d8ae89c 100644 --- a/.github/workflows/linux-tests.yml +++ b/.github/workflows/linux-tests.yml @@ -39,13 +39,6 @@ jobs: environment-name: test create-args: python=${{ matrix.PYTHON_VERSION }} micromamba-version: '1.5.10-0' - - name: Install Pixi - shell: bash -l {0} - run: | - # This script installs Pixi in ~/.pixi/bin - curl -fsSL https://pixi.sh/install.sh | sh - # This is necessary for envs-manager to detect Pixi - echo "ENV_BACKEND_EXECUTABLE=$HOME/.pixi/bin/pixi" >> $GITHUB_ENV - name: Install package and test dependencies with conda if: ${{ startsWith(matrix.USE_CONDA, 'True') }} shell: bash -el {0} From ece06dd9e67ddae85c6841bb7c1f9a14ab62b702 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Tue, 17 Jun 2025 16:17:17 -0500 Subject: [PATCH 4/4] git subrepo pull (merge) --remote=https://github.com/spyder-ide/envs-manager.git --branch=main --update --force external-deps/envs-manager subrepo: subdir: "external-deps/envs-manager" merged: "4a39ffb" upstream: origin: "https://github.com/spyder-ide/envs-manager.git" branch: "main" commit: "4a39ffb" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- external-deps/envs-manager/.gitrepo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external-deps/envs-manager/.gitrepo b/external-deps/envs-manager/.gitrepo index 0f91c13..4c384be 100644 --- a/external-deps/envs-manager/.gitrepo +++ b/external-deps/envs-manager/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/ccordoba12/envs-manager.git - branch = download-exec - commit = 1038742818f791248adbf682529ab2ef23e234c1 - parent = e61abd69a776795ce08f520cf65f6250e29d48cb + remote = https://github.com/spyder-ide/envs-manager.git + branch = main + commit = 4a39ffb75ef86a77fb3edeb086074655f650e02b + parent = 0ff6c95ab1b65e285ecfcd2d413593b3e8b5fc80 method = merge cmdver = 0.4.9