meta_package_manager.capabilities module¶

Declaration and inspection of the operations each package manager supports.

A concrete manager advertises what it can do by implementing operation methods and annotating them with the helpers defined here:

Together they expose a uniform capability surface that meta_package_manager.capabilities.implements() introspects and the CLI uses to route each command only to the managers that support it. The meta_package_manager.capabilities.Operations enum is the vocabulary of those routable actions.

class meta_package_manager.capabilities.Operations(*values)[source]¶

Bases: Enum

Recognized operation IDs that are implemented by package manager with their specific CLI invocation.

Each operation has its own CLI subcommand.

installed = 'installed'¶
outdated = 'outdated'¶
orphans = 'orphans'¶
search = 'search'¶
install = 'install'¶
upgrade = 'upgrade'¶
upgrade_all = 'upgrade_all'¶
remove = 'remove'¶
sync = 'sync'¶
cleanup = 'cleanup'¶
doctor = 'doctor'¶
meta_package_manager.capabilities.implements(manager, op)[source]¶

Inspect a manager’s implementation to check for proper support of an operation.

Accepts either a manager instance or its class; support is determined from the class hierarchy. The verdict is narrated as a single answered DEBUG line (brew implements installed.), keyed on the manager ID rather than the raw class repr.

Return type:

bool

meta_package_manager.capabilities.upgrade_all_is_synthesized(manager)[source]¶

Whether mpm backfills the manager’s upgrade --all.

True when the manager supports the operation only through the one-by-one fallback of meta_package_manager.manager.PackageManager.upgrade(): it implements outdated and upgrade_one_cli but no class in its hierarchy provides a native upgrade_all_cli. False when a native one-shot command exists, or when the operation is not supported at all.

Feeds the per-manager table of docs/augmentations.md, rendered live by meta_package_manager._docs.

Return type:

bool

meta_package_manager.capabilities.implements_method(manager, method_name)[source]¶

Whether a non-base class in the manager’s MRO defines method_name.

The orphan refinements remove_orphan and cleanup_orphan are optional variants of the remove and cleanup commands rather than standalone Operations, so implements() cannot route them. This reports whether a manager overrides the base’s stub for one, delegating the MRO walk to meta_package_manager.manager.PackageManager._defines() (shared with the base cleanup composer), so it works for config-defined managers (whose methods live on the synthesized subclass) too.

Return type:

bool

meta_package_manager.capabilities.cleanup_orphan_is_synthesized(manager)[source]¶

Whether mpm backfills the manager’s system-wide orphan sweep.

True when no class in the manager’s hierarchy overrides cleanup_orphan with a native sweep, but the manager implements both the orphans query and remove: the base meta_package_manager.manager.PackageManager.cleanup_orphan() then synthesizes the sweep by listing the orphans and removing them one by one, the exact pattern of the synthesized full upgrade --all. False when a native sweep exists, or when the manager lacks the building blocks.

Feeds the per-manager table of docs/augmentations.md, rendered live by meta_package_manager._docs.

Return type:

bool

meta_package_manager.capabilities.cooldown_is_synthesized(manager)[source]¶

Whether mpm backfills the manager’s release-age cooldown gate.

True when the manager enforces --cooldown through mpm’s own per-package probe: it implements the meta_package_manager.manager.PackageManager.release_date() probe and carries no native cooldown_env_var for mpm to inject. False when the manager’s own resolver enforces the window (a native environment variable, yay’s generated hook overlay included), or when it cannot be gated at all.

Feeds the per-manager table of docs/augmentations.md, rendered live by meta_package_manager._docs.

Return type:

bool

meta_package_manager.capabilities.supports_cleanup_cache(manager)[source]¶

Whether mpm cleanup --cache can drive the manager.

Return type:

bool

meta_package_manager.capabilities.supports_cleanup_repair(manager)[source]¶

Whether mpm cleanup --repair can drive the manager.

Return type:

bool

meta_package_manager.capabilities.exact_search_is_synthesized(manager)[source]¶

Whether mpm backfills the manager’s search --exact refinement.

True when the manager’s native search cannot filter exact matches, so meta_package_manager.manager.PackageManager.refiltered_search() does the narrowing itself. Feeds the per-manager table of docs/augmentations.md and the per-manager operation tables, rendered live by meta_package_manager._docs.

Return type:

bool

meta_package_manager.capabilities.extended_search_is_synthesized(manager)[source]¶

Whether mpm backfills the manager’s search --extended refinement.

True when the manager’s native search cannot reach descriptions, so meta_package_manager.manager.PackageManager.refiltered_search() does the filtering itself. Feeds the per-manager table of docs/augmentations.md and the per-manager operation tables, rendered live by meta_package_manager._docs.

Return type:

bool

meta_package_manager.capabilities.search_capabilities(extended_support=True, exact_support=True)[source]¶

Decorator factory to be used on search() operations to signal mpm framework manager’s capabilities.

The flags are exposed as extended_support and exact_support attributes on the wrapped method, so the documentation can derive which managers rely on meta_package_manager.manager.PackageManager.refiltered_search() to honor the --exact and --extended flags. An undecorated search carries no attribute and is read as natively supporting both refinements.

meta_package_manager.capabilities.version_not_implemented(func)[source]¶

Decorator to be used on install() or upgrade_one_cli() operations to signal that a particular operation does not implement (yet) the version specifier parameter.

Return type:

Callable[[ParamSpec(P, bound= None)], TypeVar(T)]

class meta_package_manager.capabilities.DelegatedMethod(method, cli_name)[source]¶

Bases: object

Descriptor that delegates a method call to another manager’s CLI.

When accessed on an instance, returns a wrapper that sets _delegate_cli_path on the instance so that build_cli uses the target manager’s binary instead of the host manager’s own CLI.

class meta_package_manager.capabilities.Delegate(source_class)[source]¶

Bases: object

Factory that creates DelegatedMethod descriptors for delegating operations to another package manager’s CLI.

Typical usage in a manager class body:

from .scoop import Scoop

_scoop = Delegate(Scoop)
install = _scoop.install
remove = _scoop.remove