:py:mod:`types` =============== .. py:module:: conda.plugins.types .. autoapi-nested-parse:: Definition of specific return types for use when defining a conda plugin hook. Each type corresponds to the plugin hook for which it is used. Classes ------- .. autoapisummary:: conda.plugins.types.CondaPlugin conda.plugins.types.CondaSubcommand conda.plugins.types.CondaVirtualPackage conda.plugins.types.CondaSolver conda.plugins.types.CondaPreCommand conda.plugins.types.CondaPostCommand conda.plugins.types.ChannelNameMixin conda.plugins.types.ChannelAuthBase conda.plugins.types.CondaAuthHandler conda.plugins.types.CondaHealthCheck conda.plugins.types.CondaPreSolve conda.plugins.types.CondaPostSolve conda.plugins.types.CondaSetting conda.plugins.types.ProgressBarBase conda.plugins.types.SpinnerBase conda.plugins.types.ReporterRendererBase conda.plugins.types.CondaReporterBackend conda.plugins.types.CondaRequestHeader conda.plugins.types.CondaErrorHint conda.plugins.types.CondaPreTransactionAction conda.plugins.types.CondaPostTransactionAction conda.plugins.types.CondaPrefixDataLoader conda.plugins.types.EnvironmentSpecBase conda.plugins.types.EnvironmentFormat conda.plugins.types.CondaEnvironmentSpecifier conda.plugins.types.CondaEnvironmentExporter conda.plugins.types.CondaPackageExtractor conda.plugins.types.CondaExceptionEvent conda.plugins.types.CondaExceptionObserver Attributes ---------- .. autoapisummary:: conda.plugins.types.CondaPrefixDataLoaderCallable .. py:type:: CondaPrefixDataLoaderCallable :canonical: Callable[[PathType, dict[str, PrefixRecord]], dict[str, PrefixRecord]] .. py:class:: CondaPlugin Base class for all conda plugins. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:method:: __post_init__() .. py:class:: CondaSubcommand(*, name: str, summary: str, action: collections.abc.Callable[[argparse.Namespace], int | None], configure_parser: collections.abc.Callable[[argparse.ArgumentParser], None], aliases: str | collections.abc.Iterable[str] = ()) CondaSubcommand(*, name: str, summary: str, action: collections.abc.Callable[[tuple[str, ...]], int | None], configure_parser: None = None, aliases: str | collections.abc.Iterable[str] = ()) Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda subcommand plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_subcommands`. Subcommands support two shapes, distinguished by ``configure_parser``: * If ``configure_parser`` is set, ``action`` receives the parsed :class:`argparse.Namespace`. * If ``configure_parser`` is omitted, ``action`` receives the remaining argv as :class:`tuple[str, ...]`. :param name: Subcommand name (e.g., ``conda my-subcommand-name``). :param summary: Subcommand summary, will be shown in ``conda --help``. :param action: Callable that will be run when the subcommand is invoked. :param aliases: Alternative name or names for the subcommand. :param configure_parser: Callable that will be run when the subcommand parser is initialized. .. py:attribute:: summary :type: str .. py:attribute:: action :type: collections.abc.Callable[[argparse.Namespace], int | None] | collections.abc.Callable[[tuple[str, ...]], int | None] .. py:attribute:: aliases :type: tuple[str, ...] :value: () .. py:attribute:: configure_parser :type: collections.abc.Callable[[argparse.ArgumentParser], None] | None :value: None .. py:class:: CondaVirtualPackage Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda virtual package plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_virtual_packages`. .. note:: The ``version`` and ``build`` parameters can be provided in two ways: 1. Direct values: a string or ``None`` (where ``None`` translates to ``0``) 2. Deferred callables: functions that return either a string, ``None`` (translates to ``0``), or ``NULL`` (indicates the virtual package should not be exported) :param name: Virtual package name (e.g., ``my_custom_os``). :param version: Virtual package version (e.g., ``1.2.3``). :param build: Virtual package build string (e.g., ``x86_64``). :param override_entity: Can be set to either to "version" or "build", the corresponding value will be overridden if the environment variable ``CONDA_OVERRIDE_`` is set. :param empty_override: Value to use for version or build if the override environment variable is set to an empty string. By default, this is ``NULL``. :param version_validation: Optional version validation function to ensure that the override version follows a certain pattern. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: version :type: str | None | collections.abc.Callable[[], str | None | conda.auxlib._Null] .. py:attribute:: build :type: str | None | collections.abc.Callable[[], str | None | conda.auxlib._Null] .. py:attribute:: override_entity :type: Literal['version', 'build'] | None :value: None .. py:attribute:: empty_override :type: None | conda.auxlib._Null .. py:attribute:: version_validation :type: collections.abc.Callable[[str], str | None] | None :value: None .. py:method:: to_virtual_package() -> conda.models.records.PackageRecord | conda.auxlib._Null .. py:class:: CondaSolver Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda solver plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_solvers`. :param name: Solver name (e.g., ``custom-solver``). :param backend: Type that will be instantiated as the solver backend. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: backend :type: type[conda.core.solve.Solver] .. py:class:: CondaPreCommand Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda pre-command plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_pre_commands`. :param name: Pre-command name (e.g., ``custom_plugin_pre_commands``). :param action: Callable which contains the code to be run. :param run_for: Represents the command(s) this will be run on (e.g. ``install`` or ``create``). .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: collections.abc.Callable[[str], None] .. py:attribute:: run_for :type: set[str] .. py:class:: CondaPostCommand Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda post-command plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_post_commands`. :param name: Post-command name (e.g., ``custom_plugin_post_commands``). :param action: Callable which contains the code to be run. :param run_for: Represents the command(s) this will be run on (e.g. ``install`` or ``create``). .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: collections.abc.Callable[[str], None] .. py:attribute:: run_for :type: set[str] .. py:class:: ChannelNameMixin(channel_name: str, *args, **kwargs) Class mixin to make all plugin implementations compatible, e.g. when they use an existing (e.g. 3rd party) requests authentication handler. Please use the concrete :class:`~conda.plugins.types.ChannelAuthBase` in case you're creating an own implementation. .. py:attribute:: channel_name .. py:class:: ChannelAuthBase(channel_name: str, *args, **kwargs) Bases: :py:obj:`ChannelNameMixin`, :py:obj:`requests.auth.AuthBase` Base class that we require all plugin implementations to use to be compatible. Authentication is tightly coupled with individual channels. Therefore, an additional ``channel_name`` property must be set on the ``requests.auth.AuthBase`` based class. .. py:class:: CondaAuthHandler Bases: :py:obj:`CondaPlugin` Return type to use when the defining the conda auth handlers hook. :param name: Name (e.g., ``basic-auth``). This name should be unique and only one may be registered at a time. :param handler: Type that will be used as the authentication handler during network requests. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: handler :type: type[ChannelAuthBase] .. py:class:: CondaHealthCheck Bases: :py:obj:`CondaPlugin` Return type to use when defining conda health checks plugin hook. Health checks are diagnostic actions that report on the state of a conda environment. They are invoked via ``conda doctor``. Health checks can optionally provide a fix capability, which is invoked via ``conda doctor --fix`` or ``conda doctor --fix ``. **Fixer guidelines:** Fixers receive a ``confirm`` function that handles user confirmation and dry-run mode automatically. Simply call it with your message: - In normal mode: Prompts the user for confirmation (default: no). - In dry-run mode: Raises ``DryRunExit`` (handled by the framework). - If user declines: Raises ``CondaSystemExit`` (handled by the framework). .. rubric:: Example from conda.plugins.types import ConfirmCallback def my_fixer(prefix: str, args: Namespace, confirm: ConfirmCallback) -> int: issues = find_issues(prefix) if not issues: print("No issues found.") return 0 print(f"Found {len(issues)} issues") confirm("Fix these issues?") # ... perform fix ... return 0 For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_health_checks`. :param name: Health check identifier (e.g., ``missing-files``). :param action: Callable that performs the check: ``action(prefix, verbose) -> None``. :param fixer: Optional callable that fixes issues: ``fixer(prefix, args, confirm) -> int``. The ``confirm`` parameter is a function to call for user confirmation. It raises an exception if the user declines or in dry-run mode. :param summary: Short description of what the check detects (shown in ``--list``). :param fix: Short description of what the fix does (shown in ``--list``). .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: collections.abc.Callable[[str, bool], None] .. py:attribute:: fixer :type: collections.abc.Callable[[str, argparse.Namespace, ConfirmCallback], int] | None :value: None .. py:attribute:: summary :type: str | None :value: None .. py:attribute:: fix :type: str | None :value: None .. py:class:: CondaPreSolve Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda pre-solve plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_pre_solves`. :param name: Pre-solve name (e.g., ``custom_plugin_pre_solve``). :param action: Callable which contains the code to be run. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: collections.abc.Callable[[frozenset[conda.models.match_spec.MatchSpec], frozenset[conda.models.match_spec.MatchSpec]], None] .. py:class:: CondaPostSolve Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda post-solve plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_post_solves`. :param name: Post-solve name (e.g., ``custom_plugin_post_solve``). :param action: Callable which contains the code to be run. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: collections.abc.Callable[[str, tuple[conda.models.records.PackageRecord, ...], tuple[conda.models.records.PackageRecord, ...]], None] .. py:class:: CondaSetting Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda setting plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_settings`. :param name: name of the setting (e.g., ``config_param``) :param description: description of the setting that should be targeted towards users of the plugin :param parameter: Parameter instance containing the setting definition :param aliases: alternative names of the setting .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: description :type: str .. py:attribute:: parameter :type: conda.common.configuration.Parameter .. py:attribute:: aliases :type: tuple[str, ...] :value: () .. py:class:: ProgressBarBase(description: str, **kwargs) Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: description .. py:method:: update_to(fraction) -> None :abstractmethod: .. py:method:: refresh() -> None :abstractmethod: .. py:method:: close() -> None :abstractmethod: .. py:method:: finish() .. py:method:: get_lock() :classmethod: .. py:class:: SpinnerBase(message: str, fail_message: str = 'failed\n') Bases: :py:obj:`abc.ABC` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: message .. py:attribute:: fail_message :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """failed """ .. raw:: html
.. py:method:: __enter__() :abstractmethod: .. py:method:: __exit__(exc_type, exc_val, exc_tb) :abstractmethod: .. py:class:: ReporterRendererBase Bases: :py:obj:`abc.ABC` Base class for all reporter renderers. .. py:method:: render(data: Any, **kwargs) -> str .. py:method:: detail_view(data: dict[str, str | int | bool], **kwargs) -> str :abstractmethod: Render the output in a "tabular" format. .. py:method:: envs_list(data: collections.abc.Iterable[str] | dict[str, dict[str, str | bool | None]], **kwargs) -> str :abstractmethod: Render a list of environments .. py:method:: progress_bar(description: str, **kwargs) -> ProgressBarBase :abstractmethod: Return a :class:`~conda.plugins.types.ProgressBarBase~` object to use as a progress bar .. py:method:: progress_bar_context_manager() -> contextlib.AbstractContextManager :classmethod: Returns a null context by default but allows plugins to define their own if necessary .. py:method:: spinner(message, failed_message) -> SpinnerBase :abstractmethod: Return a :class:`~conda.plugins.types.SpinnerBase~` object to use as a spinner (i.e. loading dialog) .. py:method:: prompt(message: str = 'Proceed', choices=('yes', 'no'), default: str = 'yes') -> str :abstractmethod: Allows for defining an implementation of a "yes/no" confirmation function .. py:class:: CondaReporterBackend Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda reporter backend plugin hook. For details on how this is used, see: :meth:`~conda.plugins.hookspec.CondaSpecs.conda_reporter_backends`. :param name: name of the reporter backend (e.g., ``email_reporter``) This is how the reporter backend will be referenced in configuration files. :param description: short description of what the reporter handler does :param renderer: implementation of ``ReporterRendererBase`` that will be used as the reporter renderer .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: description :type: str .. py:attribute:: renderer :type: type[ReporterRendererBase] .. py:class:: CondaRequestHeader Bases: :py:obj:`CondaPlugin` Define vendor specific headers to include HTTP requests For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_request_headers` and :meth:`~conda.plugins.hookspec.CondaSpecs.conda_session_headers`. :param name: name of the header used in the HTTP request :param value: value of the header used in the HTTP request .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: value :type: str .. py:class:: CondaErrorHint Bases: :py:obj:`conda._private.exception_guidance.GuidanceHint` Return type to use when defining a conda error hints plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_error_hints`. :param text: Human-readable description of the action to take. :param hint_code: Stable machine-readable identifier. Use snake_case. .. py:attribute:: text :type: str Human-readable description of the action to take. .. py:attribute:: hint_code :type: str Stable machine-readable identifier. Use snake_case. .. py:class:: CondaPreTransactionAction Bases: :py:obj:`CondaPlugin` Return type to use when defining a pre-transaction action hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_pre_transaction_actions`. :param name: Pre transaction name (this is just a label) :param action: Action class which implements plugin behavior. See :class:`~conda.core.path_actions.Action` for implementation details .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: type[conda.core.path_actions.Action] .. py:class:: CondaPostTransactionAction Bases: :py:obj:`CondaPlugin` Return type to use when defining a post-transaction action hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_post_transaction_actions`. :param name: Post transaction name (this is just a label) :param action: Action class which implements plugin behavior. See :class:`~conda.core.path_actions.Action` for implementation details .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: action :type: type[conda.core.path_actions.Action] .. py:class:: CondaPrefixDataLoader Bases: :py:obj:`CondaPlugin` Define new loaders to expose non-conda packages in a given prefix as ``PrefixRecord`` objects. :param name: name of the loader :param loader: a function that takes a prefix and a dictionary that maps package names to ``PrefixRecord`` objects. The newly loaded packages must be inserted in the passed dictionary accordingly, and also returned as a separate dictionary. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: loader :type: CondaPrefixDataLoaderCallable .. py:class:: EnvironmentSpecBase Bases: :py:obj:`abc.ABC` **EXPERIMENTAL** Base class for all environment specifications. Environment specs parse different types of environment definition files (environment.yml, requirements.txt, pyproject.toml, etc.) into a common Environment object model. .. py:attribute:: detection_supported :type: ClassVar[bool] :value: True .. py:method:: can_handle() -> bool :abstractmethod: Determines if the EnvSpec plugin can read and operate on the environment described by the `filename`. :returns: True, if the plugin can interpret the file. :raises Exception: raises an exception if it can not handle the file. The exception should describe why the file can not be handled. .. py:property:: env :type: conda.models.environment.Environment :abstractmethod: Express the provided environment file as a conda environment object. :returns: the conda environment represented by the file. .. py:property:: available_platforms :type: tuple[str, ...] Platforms this spec can produce an ``Environment`` for. Defaults to ``(context.subdir,)``. Multi-platform specs (``conda-lock.yml``, ``pixi.lock``) override to return every platform declared in the input file. .. py:method:: env_for(platform: str) -> conda.models.environment.Environment Return the ``Environment`` for a specific platform. Defaults to returning :attr:`env` when ``platform`` matches ``context.subdir``, and raising :class:`ValueError` otherwise. Multi-platform specs override this method to build the ``Environment`` directly from the parsed input file without constructing one per platform. To iterate every platform a spec covers: envs = (spec.env_for(p) for p in spec.available_platforms) .. py:class:: EnvironmentFormat Bases: :py:obj:`enum.Enum` Represents supported environment formats. FUTURE: Python 3.11+, use enum.StrEnum .. py:attribute:: lockfile :value: 'lockfile' .. py:attribute:: environment :value: 'environment' .. py:method:: __str__() -> str .. py:property:: label :type: str .. py:class:: CondaEnvironmentSpecifier Bases: :py:obj:`CondaPlugin` **EXPERIMENTAL** Return type to use when defining a conda env spec plugin hook. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_environment_specifiers`. :param name: name of the spec (e.g., ``environment_yaml``) :param aliases: user-friendly format aliases (e.g., ("yaml",)). Defaults to an empty list. :param environment_spec: EnvironmentSpecBase subclass handler :param default_filenames: default filename patterns this specifier handles (e.g., ("environment.yml", "*.conda-lock.yml")) :param description: user-friendly description of what the format does. Defaults to the name if not provided. :param environment_format: EnvironmentFormat category. Defaults to EnvironmentFormat.environment. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: environment_spec :type: type[EnvironmentSpecBase] .. py:attribute:: default_filenames :type: tuple[str, ...] :value: () .. py:attribute:: aliases :type: tuple[str, ...] :value: () .. py:attribute:: description :type: str | None :value: None .. py:attribute:: environment_format :type: EnvironmentFormat .. py:method:: __post_init__() .. py:class:: CondaEnvironmentExporter Bases: :py:obj:`CondaPlugin` **EXPERIMENTAL** Return type to use when defining a conda environment exporter plugin hook supporting a single platform. :param name: name of the exporter (e.g., ``environment-yaml``) :param aliases: user-friendly format aliases (e.g., ("yaml",)) :param default_filenames: default filenames this exporter handles (e.g., ("environment.yml", "environment.yaml")) :param export: callable that exports an Environment to string format for a single platform :param multiplatform_export: callable that exports an Environment to string format for multiple platforms :param description: user-friendly description of what the format does. Defaults to the name if not provided. :param environment_format: EnvironmentFormat category. Defaults to EnvironmentFormat.environment. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: aliases :type: tuple[str, ...] .. py:attribute:: default_filenames :type: tuple[str, ...] .. py:attribute:: export :type: SinglePlatformEnvironmentExport | None :value: None .. py:attribute:: multiplatform_export :type: MultiPlatformEnvironmentExport | None :value: None .. py:attribute:: description :type: str | None :value: None .. py:attribute:: environment_format :type: EnvironmentFormat .. py:method:: __post_init__() .. py:class:: CondaPackageExtractor Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda package extractor plugin hook. Package extractors handle the extraction of different package archive formats. Each extractor specifies which file extensions it supports and provides an extraction function to unpack the archive. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_package_extractors`. :param name: Extractor name (e.g., ``conda-package``, ``wheel-package``). :param extensions: List of file extensions this extractor handles (e.g., ``[".conda", ".tar.bz2"]`` or ``[".whl"]``). :param extract: Callable that extracts the package archive. Takes the source archive path and the destination directory where the package contents should be extracted. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: extensions :type: list[str] .. py:attribute:: extract :type: PackageExtract .. py:class:: CondaExceptionEvent Structured exception event passed to exception observer plugin callbacks. Frozen to prevent plugins from mutating exception state. Structured args follow the ``threading.ExceptHookArgs`` / ``sys.UnraisableHookArgs`` pattern for forward compatibility. The exception triple (``exc_type``, ``exc_value``, ``exc_traceback``) is always populated. The remaining fields describe the conda runtime state and default to ``None`` when the runtime isn't initialized (e.g. ``MemoryError`` during early startup). Runtime fields are populated all-or-nothing: if ``conda_version`` is not ``None``, the runtime was available and all other fields are populated (``active_prefix`` may still be ``None`` when no environment is active). .. warning:: Do not store references to ``exc_value`` or ``exc_traceback`` beyond the lifetime of the callback. This can create reference cycles and prevent garbage collection. :param exc_type: The exception class. :param exc_value: The exception instance. :param exc_traceback: The traceback object. :param argv: The command-line arguments at the time of error (frozen copy of ``sys.argv``). ``None`` if unavailable. :param conda_version: The conda version string. ``None`` if unavailable. :param return_code: The exit code conda will return for this error. ``None`` if unavailable. :param active_prefix: The currently active conda environment prefix, or ``None`` if no environment is active (also ``None`` when the runtime is unavailable). :param target_prefix: The prefix the command was operating on. :param channels: The configured channel names at the time of error (canonical names, e.g. ``defaults``, ``conda-forge``). :param subdir: The platform subdirectory (e.g., ``linux-64``, ``osx-arm64``). :param offline: Whether conda is running in offline mode (``--offline``). :param dry_run: Whether conda is running in dry-run mode (``--dry-run``). :param quiet: Whether conda is running in quiet mode (``--quiet``). :param json: Whether conda is running in JSON output mode (``--json``). .. py:attribute:: exc_type :type: type[BaseException] .. py:attribute:: exc_value :type: BaseException .. py:attribute:: exc_traceback :type: types.TracebackType .. py:attribute:: argv :type: tuple[str, ...] | None :value: None .. py:attribute:: conda_version :type: str | None :value: None .. py:attribute:: return_code :type: int | None :value: None .. py:attribute:: active_prefix :type: str | None :value: None .. py:attribute:: target_prefix :type: str | None :value: None .. py:attribute:: channels :type: tuple[str, ...] | None :value: None .. py:attribute:: subdir :type: str | None :value: None .. py:attribute:: offline :type: bool | None :value: None .. py:attribute:: dry_run :type: bool | None :value: None .. py:attribute:: quiet :type: bool | None :value: None .. py:attribute:: json :type: bool | None :value: None .. py:class:: CondaExceptionObserver Bases: :py:obj:`CondaPlugin` Return type to use when defining a conda exception observer plugin hook. Exception observers are purely observational, modelled after CPython's ``sys.excepthook``. They cannot suppress, modify, or redirect the exception. Their return value is ignored. For details on how this is used, see :meth:`~conda.plugins.hookspec.CondaSpecs.conda_exception_observers`. .. warning:: Do not store references to ``exc_value`` or ``exc_traceback`` beyond the lifetime of the callback. This can create reference cycles and prevent garbage collection. :param name: Observer name (e.g., ``missing-package-reporter``). :param hook: Callable invoked with a :class:`CondaExceptionEvent` instance. Must not raise; any exception is caught and logged. :param watch_for: Set of exception class names this observer watches for. Matches against the full MRO. Examples: - ``{"BaseException"}`` — fires for every exception. - ``{"Exception"}`` — all standard exceptions (excludes ``KeyboardInterrupt``, ``SystemExit``). - ``{"CondaError"}`` — all conda errors and subclasses. - ``{"PackagesNotFoundError"}`` — a specific error and its subclasses (e.g. ``PackagesNotFoundInChannelsError``). - ``{"MemoryError"}``, ``{"KeyboardInterrupt"}``, ``{"SystemExit"}`` — specific non-conda exceptions. - ``{"CondaError", "MemoryError"}`` — combine scopes. For non-``CondaError`` exceptions the conda-specific fields on :class:`CondaExceptionEvent` may be ``None``. .. py:attribute:: name :type: str User-facing name of the plugin used for selecting & filtering plugins and error messages. .. py:attribute:: hook :type: collections.abc.Callable[[CondaExceptionEvent], None] .. py:attribute:: watch_for :type: set[str]