manager#
This module contains a subclass implementation of pluggy's PluginManager.
Additionally, it contains a function we use to construct the PluginManager object and
register all plugins during conda's startup process.
Classes#
The conda plugin manager to implement behavior additional to pluggy's default plugin manager. |
Functions#
|
Get a cached version of the |
- class CondaPluginManager(*args, **kwargs)#
Bases:
pluggy.PluginManagerThe conda plugin manager to implement behavior additional to pluggy's default plugin manager.
- get_cached_solver_backend: collections.abc.Callable[[str | None], type[conda.core.solve.Solver]]#
- get_canonical_name(plugin: object) str#
Return a canonical name for a plugin object.
Note that a plugin may be registered under a different name specified by the caller of
register(plugin, name). To obtain the name of a registered plugin useget_name(plugin)instead.
- register(plugin, name: str | None = None) str | None#
Call
pluggy.PluginManager.register()and return the result or ignore errors raised, exceptValueError, which means the plugin had already been registered.
- load_plugins(*plugins) int#
Load the provided list of plugins and fail gracefully on error. The provided list of plugins can either be classes or modules with
hookimpl.
- load_entrypoints(group: str, name: str | None = None) int#
Load modules from querying the specified setuptools
group.
- get_hook_results(name: Literal[conda.plugins.subcommands]) list[conda.plugins.types.CondaSubcommand]#
- get_hook_results(name: Literal[conda.plugins.virtual_packages]) list[conda.plugins.types.CondaVirtualPackage]
- get_hook_results(name: Literal[conda.plugins.solvers]) list[conda.plugins.types.CondaSolver]
- get_hook_results(name: Literal[pre_commands]) list[conda.plugins.types.CondaPreCommand]
- get_hook_results(name: Literal[post_commands]) list[conda.plugins.types.CondaPostCommand]
- get_hook_results(name: Literal[auth_handlers]) list[conda.plugins.types.CondaAuthHandler]
- get_hook_results(name: Literal[conda.plugins.subcommands.doctor.health_checks]) list[conda.plugins.types.CondaHealthCheck]
- get_hook_results(name: Literal[pre_solves]) list[conda.plugins.types.CondaPreSolve]
- get_hook_results(name: Literal[conda.plugins.post_solves]) list[conda.plugins.types.CondaPostSolve]
- get_hook_results(name: Literal[session_headers], *, host: str) list[conda.plugins.types.CondaRequestHeader]
- get_hook_results(name: Literal[request_headers], *, host: str, path: str) list[conda.plugins.types.CondaRequestHeader]
- get_hook_results(name: Literal[settings]) list[conda.plugins.types.CondaSetting]
- get_hook_results(name: Literal[conda.plugins.reporter_backends]) list[conda.plugins.types.CondaReporterBackend]
- get_hook_results(name: Literal[pre_transaction_actions]) list[conda.plugins.types.CondaPreTransactionAction]
- get_hook_results(name: Literal[post_transaction_actions]) list[conda.plugins.types.CondaPostTransactionAction]
- get_hook_results(name: Literal[conda.plugins.prefix_data_loaders]) list[conda.plugins.types.CondaPrefixDataLoader]
- get_hook_results(name: Literal[conda.plugins.environment_specifiers]) list[conda.plugins.types.CondaEnvironmentSpecifier]
- get_hook_results(name: Literal[conda.plugins.environment_exporters]) list[conda.plugins.types.CondaEnvironmentExporter]
Return results of the plugin hooks with the given name and raise an error if there is a conflict.
- get_solvers() dict[str, conda.plugins.types.CondaSolver]#
Return a mapping from solver name to solver class.
- get_solver_backend(name: str | None = None) type[conda.core.solve.Solver]#
Get the solver backend with the given name (or fall back to the name provided in the context).
See
context.solverfor more details.Please use the cached version of this method called
get_cached_solver_backend()for high-throughput code paths which is set up as a instance-specific LRU cache.
- get_auth_handler(name: str) type[requests.auth.AuthBase] | None#
Get the auth handler with the given name or None
- get_settings() dict[str, conda.plugins.types.CondaSetting]#
Return a mapping of plugin setting name to CondaSetting objects.
This method intentionally overwrites any duplicates that may be present
- invoke_pre_commands(command: str) None#
Invokes
CondaPreCommand.actionfunctions registered withconda_pre_commands.- Parameters:
command -- name of the command that is currently being invoked
- invoke_post_commands(command: str) None#
Invokes
CondaPostCommand.actionfunctions registered withconda_post_commands.- Parameters:
command -- name of the command that is currently being invoked
- disable_external_plugins() None#
Disables all currently registered plugins except built-in conda plugins
- get_subcommands() dict[str, conda.plugins.types.CondaSubcommand]#
- get_reporter_backends() tuple[conda.plugins.types.CondaReporterBackend, Ellipsis]#
- get_reporter_backend(name: str) conda.plugins.types.CondaReporterBackend#
Attempts to find a reporter backend while providing a fallback option if it is not found.
This method must return a valid
CondaReporterBackendobject or else it will raise an exception.
- get_virtual_package_records() tuple[conda.models.records.PackageRecord, Ellipsis]#
- get_prefix_data_loaders() collections.abc.Iterable[conda.plugins.types.CondaPrefixDataLoaderCallable]#
- invoke_pre_solves(specs_to_add: frozenset[conda.models.match_spec.MatchSpec], specs_to_remove: frozenset[conda.models.match_spec.MatchSpec]) None#
Invokes
CondaPreSolve.actionfunctions registered withconda_pre_solves.- Parameters:
specs_to_add
specs_to_remove
- invoke_post_solves(repodata_fn: str, unlink_precs: tuple[conda.models.records.PackageRecord, Ellipsis], link_precs: tuple[conda.models.records.PackageRecord, Ellipsis]) None#
Invokes
CondaPostSolve.actionfunctions registered withconda_post_solves.- Parameters:
repodata_fn
unlink_precs
link_precs
- load_settings() None#
Iterates through all registered settings and adds them to the
conda.common.configuration.PluginConfigclass.
- get_config(data) conda.plugins.config.PluginConfig#
Retrieve the configuration for the plugin. :returns: The configuration object for the plugin, initialized with raw data from the context. :rtype: PluginConfig
- get_environment_specifiers() dict[str, conda.plugins.types.CondaEnvironmentSpecifier]#
Returns a mapping from environment specifier name to environment specifier.
- get_environment_specifier_by_name(source: str, name: str) conda.plugins.types.CondaEnvironmentSpecifier#
Get an environment specifier plugin by name
- Parameters:
source -- full path to the environment spec file/source
name -- name of the environment plugin to load
- Raises:
CondaValueError -- if the requested plugin is not available.
PluginError -- if the requested plugin is unable to handle the provided file.
- Returns:
an environment specifier plugin that matches the provided plugin name, or can handle the provided file
- detect_environment_specifier(source: str) conda.plugins.types.CondaEnvironmentSpecifier#
Detect the environment specifier plugin for a given spec source
Raises PluginError if more than one environment_spec plugin is found to be able to handle the file. Raises EnvironmentSpecPluginNotDetected if no plugins were found.
- Parameters:
source -- full path to the environment spec file or source
- Returns:
an environment specifier plugin that can handle the provided file
- get_environment_specifier(source: str, name: str | None = None) conda.plugins.types.CondaEnvironmentSpecifier#
Get the environment specifier plugin for a given spec source, or given a plugin name Raises PluginError if more than one environment_spec plugin is found to be able to handle the file. Raises EnvironmentSpecPluginNotDetected if no plugins were found. Raises CondaValueError if the requested plugin is not available.
- Parameters:
filename -- full path to the environment spec file/source
name -- name of the environment plugin to load
- Returns:
an environment specifier plugin that matches the provided plugin name, or can handle the provided file
- get_environment_exporters() collections.abc.Iterable[conda.plugins.types.CondaEnvironmentExporter]#
Yields all detected environment exporters.
- get_exporter_format_mapping() dict[str, conda.plugins.types.CondaEnvironmentExporter]#
Get a mapping from format names (including aliases) to environment exporters.
- Returns:
Dict mapping format name to CondaEnvironmentExporter
- Raises:
PluginError -- If multiple exporters use the same format name or alias
- detect_environment_exporter(filename: str) conda.plugins.types.CondaEnvironmentExporter#
Detect an environment exporter based on exact filename matching against default_filenames.
- Parameters:
filename -- Filename to find an exporter for (basename is used for detection)
- Returns:
CondaEnvironmentExporter that supports the filename
- Raises:
EnvironmentExporterNotDetected -- If no exporter supports the filename
PluginError -- If multiple exporters claim to support the same filename
- get_environment_exporter_by_format(format_name: str) conda.plugins.types.CondaEnvironmentExporter#
Get an environment exporter based on the format name.
- Parameters:
format_name -- Format name to find an exporter for (e.g., 'yaml', 'json', 'environment-yaml')
- Returns:
CondaEnvironmentExporter that supports the format
- Raises:
CondaValueError -- If no exporter is found for the given format
- get_pre_transaction_actions(transaction_context: dict[str, str] | None = None, target_prefix: str | None = None, unlink_precs: collections.abc.Iterable[conda.models.records.PackageRecord] | None = None, link_precs: collections.abc.Iterable[conda.models.records.PackageRecord] | None = None, remove_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None, update_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None, neutered_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None) list[conda.core.path_actions.Action]#
Get the plugin-defined pre-transaction actions.
- Parameters:
transaction_context -- Mapping between target prefixes and PrefixActions instances
target_prefix -- Target prefix for the action
unlink_precs -- Package records to be unlinked
link_precs -- Package records to link
remove_specs -- Specs to be removed
update_specs -- Specs to be updated
neutered_specs -- Specs to be neutered
- Returns:
The plugin-defined pre-transaction actions
- get_post_transaction_actions(transaction_context: dict[str, str] | None = None, target_prefix: str | None = None, unlink_precs: collections.abc.Iterable[conda.models.records.PackageRecord] | None = None, link_precs: collections.abc.Iterable[conda.models.records.PackageRecord] | None = None, remove_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None, update_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None, neutered_specs: collections.abc.Iterable[conda.models.match_spec.MatchSpec] | None = None) list[conda.core.path_actions.Action]#
Get the plugin-defined post-transaction actions.
- Parameters:
transaction_context -- Mapping between target prefixes and PrefixActions instances
target_prefix -- Target prefix for the action
unlink_precs -- Package records to be unlinked
link_precs -- Package records to link
remove_specs -- Specs to be removed
update_specs -- Specs to be updated
neutered_specs -- Specs to be neutered
- Returns:
The plugin-defined post-transaction actions
- get_plugin_manager() CondaPluginManager#
Get a cached version of the
CondaPluginManagerinstance, with the built-in and entrypoints provided by the plugins loaded.