manager#

该模块包含 pluggy 的 PluginManager 的子类实现。

此外,它包含一个函数,我们用它来构造 PluginManager 对象并在 Conda 启动过程中注册所有插件。

#

CondaPluginManager

Conda 插件管理器,用于实现 pluggy 默认插件管理器的附加行为。

函数#

get_plugin_manager(→ CondaPluginManager)

获取 CondaPluginManager 实例的缓存版本,

class CondaPluginManager(project_name: str | None = None, *args, **kwargs)#

基类: pluggy.PluginManager

Conda 插件管理器,用于实现 pluggy 默认插件管理器的附加行为。

get_cached_solver_backend#
get_canonical_name(plugin: object) str#

返回插件对象的规范名称。

请注意,插件可能以 register(plugin, name) 的调用者指定的不同名称注册。要获取已注册插件的名称,请改用 get_name(plugin)

register(plugin, name: str | None = None) str | None#

调用 pluggy.PluginManager.register() 并返回结果或忽略引发的错误,但 ValueError 除外,这意味着插件已注册。

load_plugins(*plugins) int#

加载提供的插件列表,并在出错时优雅地失败。提供的插件列表可以是类或带有 hookimpl 的模块。

load_entrypoints(group: str, name: str | None = None) int#

从查询指定的 setuptools 组加载模块。

参数:
  • group (str) -- 要加载插件的入口点组。

  • name (str) -- 如果给定,则仅加载具有给定 name 的插件。

返回类型:

int

返回:

此调用加载的插件数量。

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_solvers() dict[str, conda.plugins.types.CondaSolver]#

返回从求解器名称到求解器类的映射。

get_solver_backend(name: str | None = None) type[conda.core.solve.Solver]#

获取具有给定名称的求解器后端(或回退到上下文中提供的名称)。

有关更多详细信息,请参阅 context.solver

对于设置为实例特定的 LRU 缓存的高吞吐量代码路径,请使用此方法的缓存版本 get_cached_solver_backend()

get_auth_handler(name: str) type[requests.auth.AuthBase] | None#

获取具有给定名称的身份验证处理程序,如果没有则返回 None

get_settings() dict[str, conda.common.configuration.ParameterLoader]#

返回插件设置名称到 ParameterLoader 类的映射

此方法有意覆盖可能存在的任何重复项

invoke_pre_commands(command: str) None#

调用使用 conda_pre_commands 注册的 CondaPreCommand.action 函数。

参数:

command -- 当前正在调用的命令的名称

invoke_post_commands(command: str) None#

调用使用 conda_post_commands 注册的 CondaPostCommand.action 函数。

参数:

command -- 当前正在调用的命令的名称

disable_external_plugins() None#

禁用所有当前注册的插件,但内置的 Conda 插件除外

get_subcommands() dict[str, conda.plugins.types.CondaSubcommand]#
get_virtual_packages() tuple[conda.plugins.types.CondaVirtualPackage, Ellipsis]#
get_reporter_backends() tuple[conda.plugins.types.CondaReporterBackend, Ellipsis]#
get_reporter_backend(name: str) conda.plugins.types.CondaReporterBackend#

尝试查找报告器后端,并在未找到时提供回退选项。

此方法必须返回有效的 CondaReporterBackend 对象,否则将引发异常。

get_virtual_package_records() tuple[conda.models.records.PackageRecord, Ellipsis]#
get_session_headers(host: str) dict[str, str]#
get_request_headers(host: str, path: str) dict[str, str]#
invoke_health_checks(prefix: str, verbose: bool) None#
invoke_pre_solves(specs_to_add: frozenset[conda.models.match_spec.MatchSpec], specs_to_remove: frozenset[conda.models.match_spec.MatchSpec]) None#

调用注册到 conda_pre_solvesCondaPreSolve.action 函数。

参数:
  • 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#

调用注册到 conda_post_solvesCondaPostSolve.action 函数。

参数:
  • repodata_fn

  • unlink_precs

  • link_precs

load_settings() None#

遍历所有已注册的设置,并将它们添加到 conda.common.configuration.PluginConfig 类中。

get_plugin_manager() CondaPluginManager#

获取 CondaPluginManager 实例的缓存版本,其中加载了内置插件和入口点插件。