python_deploy: enable the eager pip update strategy

Attempt to update all dependencies of a python package to the
latest version compatible with its requirement specifier.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2025-02-08 05:48:49 -05:00
parent bda03dcf29
commit 7f1907beb3

View File

@ -351,6 +351,7 @@ class PythonDeploy(AppDeploy):
self.pip_cmd, self.server, self.cmd_helper.notify_update_response self.pip_cmd, self.server, self.cmd_helper.notify_update_response
) )
current_ref = self.current_version.tag current_ref = self.current_version.tag
pip_args = "install -U --upgrade-strategy eager"
if self.source == PackageSource.PIP: if self.source == PackageSource.PIP:
# We can't depend on the SHA being available for PyPI packages, # We can't depend on the SHA being available for PyPI packages,
# so we must compare versions # so we must compare versions
@ -359,7 +360,7 @@ class PythonDeploy(AppDeploy):
self.upstream_version <= self.current_version self.upstream_version <= self.current_version
): ):
return False return False
pip_args = f"install -U {project_name}" pip_args = f"{pip_args} {project_name}"
if rollback: if rollback:
pip_args += f"=={self.rollback_ref}" pip_args += f"=={self.rollback_ref}"
elif self.source == PackageSource.GITHUB: elif self.source == PackageSource.GITHUB:
@ -374,7 +375,7 @@ class PythonDeploy(AppDeploy):
repo += f"@{self.primary_branch}" repo += f"@{self.primary_branch}"
else: else:
repo += f"@{self.upstream_version.tag}" repo += f"@{self.upstream_version.tag}"
pip_args = f"install -U '{project_name} @ git+https://github.com/{repo}'" pip_args = f"{pip_args} '{project_name} @ git+https://github.com/{repo}'"
else: else:
raise self.server.error("Cannot update, package source is unknown") raise self.server.error("Cannot update, package source is unknown")
await self._update_pip(pip_exec) await self._update_pip(pip_exec)