Change Python dependency

MSAL

Change a dependency to a different package. Supports pyproject.toml, requirements.txt, and Pipfile. Searches all dependency scopes. For pyproject.toml, uv.lock, poetry.lock, and pdm.lock are regenerated natively without executing the package manager. For Pipfile, Pipfile.lock is regenerated natively by consulting the project's package index over the network. Not safe to use as a precondition: consults the package index over the network and publishes per-project state shared with other dependency recipes.

org.openrewrite.python.ChangeDependency

Required

The current PyPI package name to replace.

The new PyPI package name.

Optional

Optional new PEP 508 version constraint. If not specified, the original version constraint is preserved.

mod run . --recipe=org.openrewrite.python.ChangeDependency \ -P oldPackageName=requests \ -P newPackageName=httpx

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.