Skip to content

Support pip --upgrade-strategy flag (especially 'eager') for upgrading Python package dependencies #1109

@cidrblock

Description

@cidrblock

Problem

Currently, the Python package management API provides an upgrade option that adds the --upgrade flag to pip installs. However, this does not upgrade already-installed dependencies of the target package(s). Users sometimes expect that upgrading a package will also upgrade its dependencies, but pip's default behavior (--upgrade-strategy only-if-needed) will only upgrade dependencies if required.

To upgrade a package and all of its available dependencies, pip's documentation requires the --upgrade-strategy eager flag:

pip install --upgrade --upgrade-strategy eager <package>

Request

  • Please add explicit support for the --upgrade-strategy pip flag in the package management API (e.g., via a new option, e.g. upgradeStrategy).
  • This would allow users to request upgrades of dependencies eagerly (not just the minimal default strategy).
  • The API could default to existing behavior for backward compatibility, but allow consumers to specify upgradeStrategy: 'eager' (or similar) to ensure dependencies are upgraded.

Example API usage

await api.managePackages(environment, {
    install: ['my-package'],
    upgrade: true,
    upgradeStrategy: 'eager' // new option
});

Currently, users have no way to influence pip's --upgrade-strategy via the API and must work around by calling pip manually.

Benefit

  • Better aligns with real-world needs for dependency freshness
  • Matches pip's full range of capabilities
  • Avoids surprises/limitations for API users expecting eager upgrades

Thanks for considering!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions