environment#
EXPERIMENTAL Conda environment data model
Classes#
Experimental While experimental, expect both major and minor changes across minor releases. |
|
Experimental While experimental, expect both major and minor changes across minor releases. |
Attributes#
- T#
- class EnvironmentConfig#
Experimental While experimental, expect both major and minor changes across minor releases.
Data model for a conda environment config.
- channel_priority: conda.base.constants.ChannelPriority | None#
- deps_modifier: conda.base.constants.DepsModifier | None#
- sat_solver: conda.base.constants.SatSolverChoice | None#
- update_modifier: conda.base.constants.UpdateModifier | None#
- _append_without_duplicates(first: collections.abc.Iterable[T], second: collections.abc.Iterable[T]) tuple[T, Ellipsis]#
- _merge_channel_settings(first: tuple[dict[str, str], Ellipsis], second: tuple[dict[str, str], Ellipsis]) tuple[dict[str, str], Ellipsis]#
Merge channel settings.
An individual channel setting is a dict that may have the key "channels". Settings with matching "channels" should be merged together.
- _merge(other: EnvironmentConfig) EnvironmentConfig#
Experimental While experimental, expect both major and minor changes across minor releases.
Merges an EnvironmentConfig into this one. Merging rules are: * Primitive types get clobbered if subsequent configs have a value, otherwise keep the last set value * Lists get appended to and deduplicated * Dicts get updated * Special cases:
channel settings is a list of dicts, it merges inner dicts, keyed on "channel"
- classmethod from_context() EnvironmentConfig#
Experimental While experimental, expect both major and minor changes across minor releases.
Create an EnvironmentConfig from the current context
- classmethod merge(*configs: EnvironmentConfig) EnvironmentConfig#
Experimental While experimental, expect both major and minor changes across minor releases.
Merges a list of EnvironmentConfigs into a single one. Merging rules are: * Primitive types get clobbered if subsequent configs have a value, otherwise keep the last set value * Lists get appended to and deduplicated * Dicts get updated
- class Environment#
Experimental While experimental, expect both major and minor changes across minor releases.
Data model for a conda environment.
- config: EnvironmentConfig#
- explicit_packages: list[conda.models.records.PackageRecord]#
- requested_packages: list[conda.models.match_spec.MatchSpec]#
- virtual_packages: list[conda.models.records.PackageRecord]#
- __post_init__()#
- classmethod merge(*environments)#
Experimental While experimental, expect both major and minor changes across minor releases.
Merges multiple environments into a single environment following the rules: * Keeps first name and/or prefix. * Concatenates and deduplicates requirements. * Reduces configuration and variables (last key wins).
- classmethod from_prefix(prefix: str, name: str, platform: str, *, from_history: bool = False, no_builds: bool = False, ignore_channels: bool = False, channels: list[str] | None = None) Environment#
Create an Environment model from an existing conda prefix.
This method analyzes an installed conda environment and creates an Environment model that can be used for exporting or other operations.
- Parameters:
prefix -- Path to the conda environment prefix
name -- Name for the environment
platform -- Target platform (e.g., 'linux-64', 'osx-64')
from_history -- Use explicit specs from history instead of installed packages
no_builds -- Exclude build strings from package specs
ignore_channels -- Don't include channel information in package specs
- Returns:
Environment model representing the prefix
- classmethod from_cli(args: argparse.Namespace, add_default_packages: bool = False) Environment#
Create an Environment model from command-line arguments.
This method will parse command-line arguments and create an Environment object. This includes: reading files provided as cli arguments, and pulling EnvironmentConfig from the context.
- Parameters:
args -- argparse Namespace containing command-line arguments
- Returns:
An Environment object representing the cli
- static from_history(prefix: conda.common.path.PathType) list[conda.models.match_spec.MatchSpec]#
- extrapolate(platform: str) Environment#
Given the current environment, extrapolate the environment for the given platform.