Python Upgrade Workflow
Purpose
Upgrade Python projects without losing track of compatibility, validation, or package-consumer impact.
The practical job is to inventory Python requirements, dependency groups, lockfile state, framework versions, tooling strictness, and public package promises; apply one coherent upgrade slice; then run staged validation and document migration notes when users or contributors need them.
When To Use
- Use this skill when changing
requires-python, .python-version, or CI Python versions.
- Use this skill when changing
uv.lock.
- Use this skill when upgrading runtime dependencies, optional dependencies, or dependency groups.
- Use this skill when upgrading FastAPI, FastMCP, Pydantic, Ruff, mypy, pytest, or other workflow-shaping tools.
- Use this skill when package consumers, service operators, or contributors may need migration notes.
Source Check
Use repo-local files, checked-out dependency sources, Dash MCP or Dash HTTP for installed docsets, and then official project documentation when Dash/local coverage is missing or stale:
Upgrade Workflow
- Inventory current state:
rg -n "requires-python|dependencies|optional-dependencies|dependency-groups|tool.uv|tool.pytest|tool.ruff|tool.mypy|fastapi|fastmcp|pydantic|pytest|ruff|mypy"
rg --files -g 'pyproject.toml' -g 'uv.lock' -g '.python-version' -g '.github/workflows/*.yml' -g '.github/workflows/*.yaml'
- Decide upgrade boundary:
- Python version only
- runtime dependencies only
- maintainer tools only
- framework major or minor upgrade
- package metadata and compatibility range
- lockfile refresh without requirement changes
- Read release notes or migration docs for version jumps that may change behavior.
- Apply one coherent upgrade slice.
- Run staged validation:
uv sync --dev
uv run pytest
uv run ruff check .
uv run mypy .
- Add package build validation when package surfaces exist:
uv build
- Update docs, CI, release notes, or migration guidance when contributor setup, package requirements, or runtime behavior changes.
Dependency Boundary Notes
Keep dependency changes in the right place:
- runtime imports belong in
[project].dependencies
- optional user-facing features belong in
[project.optional-dependencies]
- maintainer tools belong in
[dependency-groups]
- local workspace relationships belong in
[tool.uv.sources]
Do not move tools into runtime dependencies to make CI easier.
Python Version Notes
When changing Python version support:
- update
requires-python
- update
.python-version when present
- update CI matrices or setup versions
- check lockfile compatibility
- check package classifiers when the repo ships them
- mention migration impact for contributors or package consumers
For public packages, do not narrow supported Python versions without treating it as a compatibility decision.
Framework Notes
For FastAPI, FastMCP, and Pydantic upgrades:
- check startup and lifespan behavior
- check settings and validation behavior
- check generated or mounted MCP surfaces
- run tests that cover app construction and representative endpoints or tools
- update integration guidance when the public app shape changes
For Ruff, mypy, and pytest upgrades:
- separate new tool findings from behavior changes
- avoid broad suppressions
- update config only when the new version requires or justifies it
Output Shape
Return:
Upgrade boundary: Python, runtime dependencies, tooling, framework, package metadata, or lockfile.
Changed versions: before and after.
Compatibility impact: contributors, package consumers, service operators, or none.
Validation: exact commands run and results.
Docs: migration notes, CI changes, release notes, or none.
Residual risk: checks still missing or behavior not covered.
Guardrails
- Do not combine unrelated upgrade families unless the repo already requires one coherent migration.
- Do not refresh lockfiles casually inside unrelated behavior changes.
- Do not narrow Python version support silently.
- Do not suppress new lint or type errors broadly after tool upgrades.
- Do not publish packages or create releases unless the user explicitly asks for that release step.
1---2name: python-upgrade-workflow3description: Plan and validate Python version, dependency, uv lockfile, FastAPI, FastMCP, Pydantic, Ruff, mypy, pytest, and package metadata upgrades with staged checks.4license: Apache-2.05---67# Python Upgrade Workflow89## Purpose1011Upgrade Python projects without losing track of compatibility, validation, or package-consumer impact.1213The practical job is to inventory Python requirements, dependency groups, lockfile state, framework versions, tooling strictness, and public package promises; apply one coherent upgrade slice; then run staged validation and document migration notes when users or contributors need them.1415## When To Use1617- Use this skill when changing `requires-python`, `.python-version`, or CI Python versions.18- Use this skill when changing `uv.lock`.19- Use this skill when upgrading runtime dependencies, optional dependencies, or dependency groups.20- Use this skill when upgrading FastAPI, FastMCP, Pydantic, Ruff, mypy, pytest, or other workflow-shaping tools.21- Use this skill when package consumers, service operators, or contributors may need migration notes.2223## Source Check2425Use repo-local files, checked-out dependency sources, Dash MCP or Dash HTTP for installed docsets, and then official project documentation when Dash/local coverage is missing or stale:2627- [uv documentation](https://docs.astral.sh/uv/)28- [Python packaging user guide](https://packaging.python.org/)29- [Python package version specifiers](https://packaging.python.org/specifications/version-specifiers/)30- [FastAPI documentation](https://fastapi.tiangolo.com/)31- [FastMCP documentation](https://gofastmcp.com/getting-started/welcome)32- [Pydantic documentation](https://docs.pydantic.dev/)33- [pytest documentation](https://docs.pytest.org/en/stable/)34- [Ruff documentation](https://docs.astral.sh/ruff/)35- [mypy documentation](https://mypy.readthedocs.io/en/stable/)3637## Upgrade Workflow38391. Inventory current state:40 ```bash41 rg -n "requires-python|dependencies|optional-dependencies|dependency-groups|tool.uv|tool.pytest|tool.ruff|tool.mypy|fastapi|fastmcp|pydantic|pytest|ruff|mypy"42 rg --files -g 'pyproject.toml' -g 'uv.lock' -g '.python-version' -g '.github/workflows/*.yml' -g '.github/workflows/*.yaml'43 ```442. Decide upgrade boundary:45 - Python version only46 - runtime dependencies only47 - maintainer tools only48 - framework major or minor upgrade49 - package metadata and compatibility range50 - lockfile refresh without requirement changes513. Read release notes or migration docs for version jumps that may change behavior.524. Apply one coherent upgrade slice.535. Run staged validation:54 ```bash55 uv sync --dev56 uv run pytest57 uv run ruff check .58 uv run mypy .59 ```606. Add package build validation when package surfaces exist:61 ```bash62 uv build63 ```647. Update docs, CI, release notes, or migration guidance when contributor setup, package requirements, or runtime behavior changes.6566## Dependency Boundary Notes6768Keep dependency changes in the right place:6970- runtime imports belong in `[project].dependencies`71- optional user-facing features belong in `[project.optional-dependencies]`72- maintainer tools belong in `[dependency-groups]`73- local workspace relationships belong in `[tool.uv.sources]`7475Do not move tools into runtime dependencies to make CI easier.7677## Python Version Notes7879When changing Python version support:8081- update `requires-python`82- update `.python-version` when present83- update CI matrices or setup versions84- check lockfile compatibility85- check package classifiers when the repo ships them86- mention migration impact for contributors or package consumers8788For public packages, do not narrow supported Python versions without treating it as a compatibility decision.8990## Framework Notes9192For FastAPI, FastMCP, and Pydantic upgrades:9394- check startup and lifespan behavior95- check settings and validation behavior96- check generated or mounted MCP surfaces97- run tests that cover app construction and representative endpoints or tools98- update integration guidance when the public app shape changes99100For Ruff, mypy, and pytest upgrades:101102- separate new tool findings from behavior changes103- avoid broad suppressions104- update config only when the new version requires or justifies it105106## Output Shape107108Return:1091101. `Upgrade boundary`: Python, runtime dependencies, tooling, framework, package metadata, or lockfile.1112. `Changed versions`: before and after.1123. `Compatibility impact`: contributors, package consumers, service operators, or none.1134. `Validation`: exact commands run and results.1145. `Docs`: migration notes, CI changes, release notes, or none.1156. `Residual risk`: checks still missing or behavior not covered.116117## Guardrails118119- Do not combine unrelated upgrade families unless the repo already requires one coherent migration.120- Do not refresh lockfiles casually inside unrelated behavior changes.121- Do not narrow Python version support silently.122- Do not suppress new lint or type errors broadly after tool upgrades.123- Do not publish packages or create releases unless the user explicitly asks for that release step.