common
#
Common utilities for conda command line tools.
Functions#
|
|
|
|
|
Determines whether the args we pass in are pointing to the active prefix. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Verifies the prefix is a valid conda environment. |
|
Verifies the environment directory is writable by trying to access |
Validates that the configured subdir is ok. A subdir that is different from |
|
|
|
Validates that all the provided environment files are of the same format type. |
|
|
Validate the existence of an environment file. |
Attributes#
- confirm(message='Proceed', choices=('yes', 'no'), default='yes', dry_run=NULL)#
- confirm_yn(message='Proceed', default='yes', dry_run=NULL)#
- is_active_prefix(prefix: str) bool #
Determines whether the args we pass in are pointing to the active prefix. Can be used a validation step to make sure operations are not being performed on the active prefix.
- arg2spec(arg, json=False, update=False)#
- specs_from_args(args, json=False)#
- spec_pat#
- strip_comment(line)#
- spec_from_line(line)#
- specs_from_url(url, json=False)#
- names_in_specs(names, specs)#
- disp_features(features)#
- stdout_json(d)#
- stdout_json_success(success=True, **kwargs)#
- print_envs_list(known_conda_prefixes, output=True)#
- check_non_admin()#
- validate_prefix(prefix) str #
Verifies the prefix is a valid conda environment.
- Raises:
EnvironmentLocationNotFound -- Non-existent path or not a directory.
DirectoryNotACondaEnvironmentError -- Directory is not a conda environment.
- Returns:
Valid prefix.
- Return type:
- validate_prefix_is_writable(prefix: str) str #
Verifies the environment directory is writable by trying to access the conda-meta/history file. If this file is not writable then we assume the whole prefix is not writable and raise an exception.
- Raises:
EnvironmentNotWritableError -- Conda does not have permission to write to the prefix
- Returns:
Valid prefix.
- Return type:
- validate_subdir_config()#
Validates that the configured subdir is ok. A subdir that is different from the native system is only allowed if it comes from the global configuration, or from an environment variable.
- Raises:
OperationNotAllowed -- Active environment is not allowed to request non-native platform packages
- print_activate(env_name_or_prefix)#
- validate_environment_files_consistency(files: list[str]) None #
Validates that all the provided environment files are of the same format type.
This function checks if all provided environment files are of the same format type using the conda plugin system's environment specifiers. It prevents mixing different environment file formats (e.g., YAML, explicit package lists, requirements.txt).
- Raises:
EnvironmentFileTypeMismatchError -- When files with different formats are found
- validate_file_exists(filename: str)#
Validate the existence of an environment file.
This function checks if the given
filename
exists as an environment file. If the filename has a URL scheme supported byCONDA_SESSION_SCHEMES
, it assumes the file is accessible and returns without further validation. Otherwise, it expands the given path and verifies its existence. If the file does not exist, anEnvironmentFileNotFound
exception is raised.- Parameters:
filename (str) -- The path or URL of the environment file to validate.
- Raises:
EnvironmentFileNotFound -- If the file does not exist and is not a valid URL.