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:
meta_package_manager.capabilities.search_capabilities()andmeta_package_manager.capabilities.version_not_implemented()flag the refinements an operation does not natively support, letting the framework compensate (refiltering search results, warning about ignored version pins).meta_package_manager.capabilities.Delegateandmeta_package_manager.capabilities.DelegatedMethodlet a manager reuse another manager’s CLI for an operation instead of reimplementing it.
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:
EnumRecognized 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
DEBUGline (brew implements installed.), keyed on the manager ID rather than the raw class repr.- Return type:
- meta_package_manager.capabilities.upgrade_all_is_synthesized(manager)[source]¶
Whether
mpmbackfills the manager’supgrade --all.Truewhen the manager supports the operation only through the one-by-one fallback ofmeta_package_manager.manager.PackageManager.upgrade(): it implementsoutdatedandupgrade_one_clibut no class in its hierarchy provides a nativeupgrade_all_cli.Falsewhen 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 bymeta_package_manager._docs.- Return type:
- 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_orphanandcleanup_orphanare optional variants of theremoveandcleanupcommands rather than standaloneOperations, soimplements()cannot route them. This reports whether a manager overrides the base’s stub for one, delegating the MRO walk tometa_package_manager.manager.PackageManager._defines()(shared with the basecleanupcomposer), so it works for config-defined managers (whose methods live on the synthesized subclass) too.- Return type:
- meta_package_manager.capabilities.cleanup_orphan_is_synthesized(manager)[source]¶
Whether
mpmbackfills the manager’s system-wide orphan sweep.Truewhen no class in the manager’s hierarchy overridescleanup_orphanwith a native sweep, but the manager implements both theorphansquery andremove: the basemeta_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 fullupgrade --all.Falsewhen a native sweep exists, or when the manager lacks the building blocks.Feeds the per-manager table of
docs/augmentations.md, rendered live bymeta_package_manager._docs.- Return type:
- meta_package_manager.capabilities.cooldown_is_synthesized(manager)[source]¶
Whether
mpmbackfills the manager’s release-age cooldown gate.Truewhen the manager enforces--cooldownthroughmpm’s own per-package probe: it implements themeta_package_manager.manager.PackageManager.release_date()probe and carries no nativecooldown_env_varformpmto inject.Falsewhen 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 bymeta_package_manager._docs.- Return type:
- meta_package_manager.capabilities.supports_cleanup_cache(manager)[source]¶
Whether
mpm cleanup --cachecan drive the manager.- Return type:
- meta_package_manager.capabilities.supports_cleanup_repair(manager)[source]¶
Whether
mpm cleanup --repaircan drive the manager.- Return type:
- meta_package_manager.capabilities.exact_search_is_synthesized(manager)[source]¶
Whether
mpmbackfills the manager’ssearch --exactrefinement.Truewhen the manager’s native search cannot filter exact matches, someta_package_manager.manager.PackageManager.refiltered_search()does the narrowing itself. Feeds the per-manager table ofdocs/augmentations.mdand the per-manager operation tables, rendered live bymeta_package_manager._docs.- Return type:
- meta_package_manager.capabilities.extended_search_is_synthesized(manager)[source]¶
Whether
mpmbackfills the manager’ssearch --extendedrefinement.Truewhen the manager’s native search cannot reach descriptions, someta_package_manager.manager.PackageManager.refiltered_search()does the filtering itself. Feeds the per-manager table ofdocs/augmentations.mdand the per-manager operation tables, rendered live bymeta_package_manager._docs.- Return type:
- meta_package_manager.capabilities.search_capabilities(extended_support=True, exact_support=True)[source]¶
Decorator factory to be used on
search()operations to signalmpmframework manager’s capabilities.The flags are exposed as
extended_supportandexact_supportattributes on the wrapped method, so the documentation can derive which managers rely onmeta_package_manager.manager.PackageManager.refiltered_search()to honor the--exactand--extendedflags. An undecoratedsearchcarries 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()orupgrade_one_cli()operations to signal that a particular operation does not implement (yet) the version specifier parameter.
- class meta_package_manager.capabilities.DelegatedMethod(method, cli_name)[source]¶
Bases:
objectDescriptor that delegates a method call to another manager’s CLI.
When accessed on an instance, returns a wrapper that sets
_delegate_cli_pathon the instance so thatbuild_cliuses the target manager’s binary instead of the host manager’s own CLI.
- class meta_package_manager.capabilities.Delegate(source_class)[source]¶
Bases:
objectFactory that creates
DelegatedMethoddescriptors 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