upgrade-python
Skill4 starsChanged 10 days agoMITView on GitHub
Upgrade a project's Python version one minor release at a time (for example 3.10 → 3.11 → 3.12 → 3.13) with pyupgrade, deprecation warnings treated as errors, dependency re-locking, C-extension checks and every pin (requires-python, .python-version, Docker, CI, deploy runtimes) updated together, then verify with tests and a production-image smoke test. Also covers starting a Python 2.7 port. Use when asked to upgrade Python, when legacy/python-legacy applies (3.10 reached EOL on 1 Oct 2026), or when a dependency needs a newer Python.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- getsentry/pypitheir own version, first seen Oct 16, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- getsentry/pypi★ 23same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- llms.txtllms.txt
- cve-checkSkill
- dependency-vetSkill
- git-commitSkill
- incident-supply-chainSkill
- migrate-angularjsSkill
- migrate-class-to-hooksSkill
- migrate-cordovaSkill
- migrate-cra-to-viteSkill
- migrate-dotnet-frameworkSkill
- migrate-ingress-nginxSkill
- migrate-strutsSkill
- migrate-vue2Skill
- migrate-xamarinSkill
- secrets-scanSkill
- security-auditSkill
- threat-model-liteSkill
- upgrade-angularSkill
- upgrade-djangoSkill
- upgrade-dotnetSkill
- upgrade-expressSkill
- upgrade-jquerySkill
- upgrade-laravelSkill
- upgrade-nestjsSkill
- upgrade-nextjsSkill
- upgrade-nodeSkill
- upgrade-nuxtSkill
- upgrade-phpSkill
- upgrade-railsSkill
- upgrade-react-nativeSkill
- upgrade-spring-bootSkill
- upgrade-supabaseSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Surface the next version's breakage now: run the tests with warnings as errors on the current version:
- Distinctive: line 42
update packages without wheels for the new version, or replace unmaintained ones.
- Very specific: line 43
run pyupgrade --py311-plus $(git ls-files '*.py') (match the flag to the new minimum: --py312-plus, --py313-plus, --py314-plus) and review …
- Distinctive: line 72
Never jump several minor versions at once when C extensions or old frameworks are involved.
- Distinctive: line 73
Never silence deprecation warnings globally to make tests pass.
- Distinctive: line 74
Never leave pins out of sync between local, CI and production.
- Very specific: line 75
Never auto-commit, push or deploy.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Upgrade Python
When to use
- The user asks to upgrade Python, or the project runs an EOL version (3.10 or older; see
legacy/python-legacy). - A dependency upgrade (Django 6.x, SQLAlchemy 2.1, Starlette 1.x) needs a newer Python.
- Planning ahead: 3.11 reaches EOL in Oct 2027.
Before you start
- List every place that pins Python:
requires-python,.python-version,runtime.txt,tox.ini/noxfile.py,setup.cfgclassifiers, Dockerfiles (FROM python:…), CI matrices, serverless/PaaS runtimes, and type-checker settings (pythonVersion,python_version). - List C-extension and binary dependencies (
numpy,pandas,psycopg,cryptography,lxml,grpcio,pydantic-core, anything without wheels for the target). - Working tree clean; new branch (
chore/python-3.13). - Ask the user:
- the target: 3.13 (security support to Oct 2029; most compatible) or 3.14 (bugfix, to Oct 2030). 3.15 (Oct 2026) is fine for new work once dependencies publish wheels;
- whether to stop for review after each minor hop;
- whether network installs are approved (
core/supply-chaincooldown applies).
Steps
- Baseline on the current version: locked install, lint, type check, tests, and the production image starting. Record failures first.
Surface the next version's breakage now: run the tests with warnings as errors on the current version:
uv run python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m pytestFix each warning (or record it with the owning dependency) before changing versions.
- Hop one minor version (for example 3.10 → 3.11):
- install it (
uv python install 3.11) and update all pins in one change (requires-python = ">=3.11",.python-version, Docker base image by digest, CI, runtimes, type-checker version); - re-lock (
uv lock --upgrade-package <only what's needed>or a fulluv lockif the user agrees) and sync; - update packages without wheels for the new version, or replace unmaintained ones;
- run
pyupgrade --py311-plus $(git ls-files '*.py')(match the flag to the new minimum:--py312-plus,--py313-plus,--py314-plus) and review the diff; Ruff'sUPrules withtarget-versiondo the same.
- install it (
- Fix version-specific changes listed in that version's "What's New" (Porting section). Common ones:
- 3.11:
asyncio.coroutineremoved; stricterenumandtypingbehavior; - 3.12:
distutilsremoved (usesetuptools/packaging);impremoved;datetime.utcnow()deprecated (usedatetime.now(UTC)); - 3.13: dead batteries removed (
cgi,crypt,telnetlib,nntplib,imghdr,pipes, …);locale.getdefaultlocaledeprecated; - 3.14: deferred evaluation of annotations by default;
asynciochild-watcher APIs removed.
- 3.11:
- Verify (next section). Show the diff and results; wait for approval before the next hop. Commit only when asked (
git-commitskill). - Repeat until the target, then switch to
languages/pythonand update the frameworks' version rules if needed.
Python 2.7
Port before upgrading: get a test suite running, run python -m pyupgrade --py3-plus after a 2→3 conversion pass (python-future's futurize or manual), fix bytes/str boundaries and integer division, then follow the steps above from 3.x. Plan this as its own project with the user.
Verify
uv run python --version # the hop's target, on every runner
uv sync --locked
uv run ruff check . && uv run ruff format --check .
uv run pyright # or: mypy
uv run python -W error::DeprecationWarning -m pytest
uv run pip-audit
grep -rnE "python_requires|requires-python|FROM python:|python-version|pythonVersion" pyproject.toml setup.cfg Dockerfile* .github/ .python-version 2>/dev/null # no old pins leftThen build and start the production image: imports of C extensions succeed, the app serves key routes, workers and scheduled jobs start.
Safety
- Never jump several minor versions at once when C extensions or old frameworks are involved; never upgrade Python and a framework major in one change.
- Never silence deprecation warnings globally to make tests pass; fix or document them.
- Never leave pins out of sync between local, CI and production.
- Never auto-commit, push or deploy; don't hand-edit
uv.lock; ask before a full re-lock.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

