Upgrade Python version in project files
ProprietaryUpdate the Python version referenced in project metadata and packaging files to a target version. Updates Pipfile (python_version / python_full_version), pyproject.toml ([project] requires-python and Poetry's [tool.poetry.dependencies] python), setup.py and setup.cfg (python_requires), .python-version files, and Ruff's target-version (in [tool.ruff], ruff.toml, and .ruff.toml). When a lock file (uv.lock or Pipfile.lock) is present, it is regenerated natively to match, without executing the package manager or requiring one on PATH. Only references older than the target are changed; a file already on a newer version is left as-is. Dockerfiles, CI workflows, and infrastructure files are handled by the other recipes that UpgradePythonVersion composes, and requirements.txt is not modified because it pins package versions, not the interpreter version.
org. openrewrite. python. migrate. UpgradePythonProjectFilesRequired
The target Python version as MAJOR.MINOR (for example 3.12). Any patch component is dropped; the minor release is the upgrade target.
mod run . --recipe= org. openrewrite. python. migrate. UpgradePythonProjectFiles \
-P version=3.12Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.