Repair missing packages during environment sync
Dependency Audit / dependency-audit (push) Successful in 1m50s
Deployment Installer / deployment-installer (push) Successful in 6s
Security Audit / security-audit (push) Successful in 10m50s

This commit is contained in:
2026-08-03 14:06:41 +02:00
parent b7cc2d2df4
commit 32689d027a
2 changed files with 63 additions and 2 deletions
+9 -2
View File
@@ -149,6 +149,7 @@ def main() -> int:
requirements=requirements,
python=python,
local_requirements=local_requirements,
repair_requirements=environment.stale_requirements,
force=args.force,
)
@@ -250,6 +251,7 @@ def build_install_plan(
python: str,
local_requirements: tuple[RequirementEntry, ...],
force: bool,
repair_requirements: tuple[RequirementEntry, ...] = (),
) -> InstallPlan:
full_command = (python, "-m", "pip", "install", "-r", str(requirements))
if force:
@@ -273,7 +275,12 @@ def build_install_plan(
removed_paths = set(previous_inputs) - set(current_inputs)
stale_requirements = requirements_key in changed_paths or requirements_key in removed_paths
installs: list[tuple[str, ...]] = []
# Metadata changes and installation drift can happen together. Keep both
# sets in one resolver transaction so a selective metadata sync also
# repairs local distributions omitted from the current environment.
installs: list[tuple[str, ...]] = [
requirement.install_args for requirement in repair_requirements
]
warnings: list[str] = []
if stale_requirements:
@@ -322,7 +329,7 @@ def build_install_plan(
)
return InstallPlan(
"Selective Python environment sync",
f"installing {len(deduped_installs)} stale local requirement(s) in one resolver transaction.",
f"installing {len(deduped_installs)} stale or missing local requirement(s) in one resolver transaction.",
(command,),
tuple(warnings),
)