$npx skillfedfor your agent

pyupgrade

A tool to automatically upgrade syntax for newer versions.

Worth itPyPI Quality AssuranceReleased Nov 20251.9M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pyupgrade-3.21.2-py2.py3-none-any.whl
v3.21.2 · released 2025-11-19 · Python >=3.10 · 1 runtime deps: tokenize-rt

Yes. pyupgrade is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem for teams modernizing Python codebases. Its permissive MIT license and broad adoption (top 5000 PyPI packages) make it a low-risk addition to development workflows, especially when integrated as a pre-commit hook to enforce syntax consistency automatically.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later to run the tool itself; the code being upgraded can target older Python versions via command-line flags.
  • Low friction install with a single runtime dependency (tokenize-rt).
  • Active maintenance with recent releases; last commit 2026-08-13 and 4113 repository stars indicate steady use and support.

License · maintenance · safety

MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

last release 2025-11-19 (268 days) · last repo commit 2026-08-13 · 4,113 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,860,922 downloads/mo, #3,483 on PyPI

Verify before relying

pip install pyupgrade

# Run on a single file
pyupgrade myfile.py

# Or add to .pre-commit-config.yaml:
# - repo: https://github.com/asottile/pyupgrade
#   rev: v3.21.2
#   hooks:
#   - id: pyupgrade
  • Whether all syntax rewrites are safe to apply automatically without manual review in large codebases
  • Performance characteristics when processing very large Python files or projects
  • Specific Python version targets supported by command-line flags beyond those shown in examples
Same gist for agents: .md · .json

What it is and what it does

pyupgrade is a command-line tool and pre-commit hook that scans Python source files and automatically rewrites code to use modern syntax patterns. It handles a wide range of modernizations: converting old-style set and dict construction to comprehensions, replacing printf-style string formatting with `.format()` calls, removing unnecessary `u''` prefixes, simplifying `super()` calls, removing Python 2 compatibility code and six library usage, and eliminating deprecated unittest method aliases. The tool is driven by command-line flags that control which Python version's features to target, allowing gradual modernization of codebases.

It runs as a standalone tool on individual files or directories, or integrates into pre-commit hooks to enforce modernization on every commit. The single runtime dependency is tokenize-rt, which handles Python tokenization. The tool requires Python 3.10 or later to run, though it can modernize code written for older Python versions by removing version-specific compatibility patterns.

Use it for

  • Automatically upgrade a legacy codebase from Python 2 to Python 3 by removing six imports and compatibility shims
  • Enforce consistent modern syntax in CI/CD pipelines via pre-commit hooks to catch outdated patterns before merge
  • Batch-modernize string formatting from printf-style to `.format()` across thousands of lines of code
  • Remove deprecated unittest method aliases (e.g., `failUnlessEqual` → `assertEqual`) from test suites
  • Simplify class definitions by removing unnecessary `object` inheritance and rewriting metaclass declarations

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

pyupgrade is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem for teams modernizing Python codebases. Its permissive MIT license and broad adoption (top 5000 PyPI packages) make it a low-risk addition to development workflows, especially when integrated as a pre-commit hook to enforce syntax consistency automatically.

Install

pyupgrade on PyPI

Before you install

Low friction install with a single runtime dependency (tokenize-rt). Active maintenance with recent releases; last commit 2026-08-13 and 4113 repository stars indicate steady use and support.

Requires Python 3.10 or later to run the tool itself; the code being upgraded can target older Python versions via command-line flags.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install pyupgrade

# Run on a single file
pyupgrade myfile.py

# Or add to .pre-commit-config.yaml:
# - repo: https://github.com/asottile/pyupgrade
#   rev: v3.21.2
#   hooks:
#   - id: pyupgrade

Verify before relying

  • Whether all syntax rewrites are safe to apply automatically without manual review in large codebases
  • Performance characteristics when processing very large Python files or projects
  • Specific Python version targets supported by command-line flags beyond those shown in examples

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
tokenize-rt
MaintenanceActively maintained 268 days since the last release
Last repo commit
First released
Downloads1,860,922 / month, #3,483 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Evidence: pyupgrade-3.21.2-py2.py3-none-any.whl

Tags

Capabilities
python syntax modernizerautomatic code upgraderdeprecated syntax fixerpython modernization toolcode style updaterpython linter upgradesyntax rewriter
Topics
code-modernizationpre-commit-hooksyntax-rewriter

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “python syntax modernizer”

  • pyupgradeAutomatically rewrites Python source code to use newer syntax…
  • refurbRefurb is a static analysis tool that scans Python code to identify…
  • parsoParso is a Python parser that recovers from syntax errors and parses…

Give your agent the search over MCP, or paste the wish link into any chat.

More Quality Assurance packages

coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
ruff Worth it
PyPI · Python Modules · released Aug 2026

Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.

MITcompiled wheel · 3.7+
316.1Mdownloads / mo
pexpect With conditions
PyPI · Software Development · released Nov 2023

Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.

ISCpure Pythonaging
200.8Mdownloads / mo
black Worth it
PyPI · Python Modules · released May 2026

Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.

MITpure Python · 3.10+
179.9Mdownloads / mo
pytest-xdist Worth it
PyPI · Utilities · released Jul 2025

pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.

Install it if your test suite takes long enough that parallelization would save meaningful time.

MITpure Python · 3.9+
177.1Mdownloads / mo
cfn-lint Worth it
PyPI · Quality Assurance · released Aug 2026

Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.

Install it if you work with CloudFormation templates.

MIT-0pure Python
114.9Mdownloads / mo

See also absolufy-imports · reorder-python-imports · to-requirements.txt · google-pasta · yesqa · add-trailing-comma · darker · django-upgrade · update · unidiff2