asottile/pyupgrade
A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language. observed · 2026-08-28
Health v2 · maintenance only
77/100
- Activity 99
- Release rhythm 35
- Longevity 100
Flags: no_releases
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 3473
- days_rel: n/a
- days_push: 8
- n_releases_24m: 0
Adoption not part of the score
4113 stars · 217 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
pyupgrade is a CLI tool and pre-commit hook that automatically rewrites Python source code to use modern syntax for newer Python versions. It applies safe, opinionated fixes such as set literals, dict comprehensions, f-string-friendly formatting, and removal of obsolete unicode literals.
Use cases
- automatically upgrade python syntax to newer versions
- modernize legacy python codebase
- add a pre-commit hook to fix outdated python syntax
- convert printf-style formatting to str.format
- remove unnecessary lambdas in defaultdict calls
- fix invalid escape sequences in strings
When to choose
- you want automated, safe syntax upgrades for python code
- you already use pre-commit and want an autofix hook
- you are migrating a codebase toward newer python versions
When to avoid
- you need general-purpose linting beyond syntax upgrades (use ruff or flake8)
- you want to preserve legacy formatting exactly as-is
- you work in a non-python language
Facets
cli-tool · maturity active
linter formatter cli developer-tools programming-languages python cli cross-platform python pre-commit code-modernization syntax-upgrade autofix automation
2 sources
- readme: https://github.com/asottile/pyupgrade · fetched 2026-08-28 · f9dec645cf9e
- registry_pypi: https://pypi.org/pypi/pyupgrade/json · fetched 2026-08-29 · 9bc2619da34d
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| asottile/pyupgrade | main | 77 |
For agents
markdown · JSON · MCP: product_card(name="asottile/pyupgrade")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem