Environments#

Environment creation, removal, and inspection via conda’s APIs.

Environment manager — create, update, and remove project-local envs.

Uses conda’s Solver API to install packages into project-scoped environments under .conda/envs/<name>/. Each environment is a standard conda prefix that can be activated with conda activate.

conda_workspaces.envs.clean_all(ctx: WorkspaceContext) None[source]#

Remove all project-local environments.

conda_workspaces.envs.get_environment_info(ctx: WorkspaceContext, env_name: str) dict[str, str | int | bool][source]#

Return basic info about an installed environment.

conda_workspaces.envs.install_environment(ctx: WorkspaceContext, resolved: ResolvedEnvironment, *, force_reinstall: bool = False, dry_run: bool = False) None[source]#

Create or update a project-local environment.

Uses conda’s Solver API directly instead of shelling out, which avoids the overhead of a subprocess and gives full control over the solve/install transaction.

PyPI dependencies are translated to conda names and merged into the same solver call as conda dependencies, relying on conda-pypi’s wheel extractor and conda-rattler-solver to resolve and install them in a single pass.

Raises SolveError if dependency resolution fails.

conda_workspaces.envs.list_installed_environments(ctx: WorkspaceContext) list[str][source]#

Return names of environments that are currently installed.

conda_workspaces.envs.remove_environment(ctx: WorkspaceContext, env_name: str) None[source]#

Remove a project-local environment by deleting its prefix.