:py:mod:`common` ================ .. py:module:: conda.cli.common .. autoapi-nested-parse:: Common utilities for conda command line tools. Functions --------- .. autoapisummary:: conda.cli.common.is_active_prefix conda.cli.common.arg2spec conda.cli.common.specs_from_args conda.cli.common.strip_comment conda.cli.common.spec_from_line conda.cli.common.specs_from_url conda.cli.common.names_in_specs conda.cli.common.disp_features conda.cli.common.stdout_json conda.cli.common.stdout_json_success conda.cli.common.check_non_admin conda.cli.common.validate_subdir_config conda.cli.common.print_activate conda.cli.common.get_name_prefix_from_env_file conda.cli.common.validate_environment_files_consistency conda.cli.common.validate_file_exists Attributes ---------- .. autoapisummary:: conda.cli.common.spec_pat .. py:function:: 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. .. py:function:: arg2spec(arg: str, update: bool = False) -> str .. py:function:: specs_from_args(args: collections.abc.Iterable[str]) -> list[str] .. py:data:: spec_pat .. py:function:: strip_comment(line: str) -> str .. py:function:: spec_from_line(line: str) -> str .. py:function:: specs_from_url(url: str) -> list[str] .. py:function:: names_in_specs(names, specs) .. py:function:: disp_features(features) .. py:function:: stdout_json(d) .. py:function:: stdout_json_success(success=True, **kwargs) .. py:function:: check_non_admin() .. py:function:: 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 .. py:function:: print_activate(env_name_or_prefix) .. py:function:: get_name_prefix_from_env_file(file: str) -> tuple[str | None, str | None] Get name and prefix from an environment spec file. Intentionally swallows all errors and logs them. .. py:function:: 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 .. py:function:: 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 by ``CONDA_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, an ``EnvironmentFileNotFound`` exception is raised. :param filename: The path or URL of the environment file to validate. :raises EnvironmentFileNotFound: If the file does not exist and is not a valid URL.