meta_package_manager.cli_maintenance module¶

The maintenance subcommands: the state changers and diagnostics.

install, upgrade, remove, sync, cleanup and doctor, plus the machinery only they need: the cooldown gate, the sourced-operation dispatch that resolves each package spec to its source managers, and the cleanup category selection.

The mpm group itself, and the per-package action engine restore also drives, live in meta_package_manager.cli.

Todo

Add a --force/--reinstall flag to install.

meta_package_manager.cli_maintenance.UPGRADE_RESULTS = (PackageOutcome.UPGRADED, PackageOutcome.DOWNGRADED, PackageOutcome.COOLDOWN, PackageOutcome.STILL_OUTDATED)¶

The outcomes a full upgrade counts on each manager’s trail line, the upgrades first.

meta_package_manager.cli_maintenance.SWEEP_RESULTS = (PackageOutcome.REMOVED,)¶

The outcome an orphan sweep counts on each manager’s trail line.

meta_package_manager.cli_maintenance.DRY_RUN_HINT = '--dry-run also simulates the read-only queries, so it cannot find which manager provides a package. Run with --plan to resolve it.'¶

Why --dry-run leaves a package untied to a manager unresolved, and the option that resolves it.

meta_package_manager.cli_maintenance.cooldown_permits(manager)[source]¶

Decide whether a release-introducing operation may run on manager.

Returns True when no cooldown is active, when the manager can enforce it (natively, or through the per-package release_date probe), or when the manager’s resolved CooldownPolicy waives the requirement (best-effort) or exempts it outright (off). Returns False (after logging the skip) when an active cooldown cannot be enforced and the fail-closed default still holds, so the caller leaves the manager alone rather than letting a freshly-published version slip in.

The skip message names both remedies, the one-shot keyword and the persistent configuration key: opting out of a supply-chain safeguard is a standing policy decision, not something to re-type on every run.

Return type:

bool

meta_package_manager.cli_maintenance.CLEANUP_CATEGORIES = ('orphans', 'cache', 'repair')¶

Cumulative categories the cleanup subcommand decomposes into.

Each category has a two-sided --<category>/--skip-<category> flag pair. Positive flags narrow the run to exactly the listed categories; skip flags subtract categories from the default selection.

meta_package_manager.cli_maintenance.DEFAULT_CLEANUP_CATEGORIES = frozenset({'cache', 'repair'})¶

Categories a plain cleanup (no category flag) runs.

The orphan sweep is deliberately absent: it removes packages, where cache pruning and state repair only reclaim disk and fix metadata. Keeping it strictly behind an explicit --orphans makes the default non-destructive and identical on every manager, native sweep or not, mirroring how remove keeps its cascade behind the same flag.