macOS
brew install pyupgradelocal Homebrew formula metadata
sudo port install pyupgradeMacPorts ports tree · python/pyupgrade/Portfile · source: api.github.com
brew / rank 3276
Upgrade syntax for newer versions of Python. Version 3.21.2 via Homebrew; verified from local package data. Also installable with debian: sudo apt install pyupgrade.
install
brew install pyupgradelocal Homebrew formula metadata
sudo port install pyupgradeMacPorts ports tree · python/pyupgrade/Portfile · source: api.github.com
sudo apt install pyupgradeDebian stable package indexes · pyupgrade · source: deb.debian.org
nix profile install nixpkgs#pyupgradenixpkgs package indexes · pyupgrade · source: raw.githubusercontent.com
sudo pacman -S pyupgradeArch Linux sync databases · pyupgrade · source: geo.mirror.pkgbuild.com
overview
Upgrade syntax for newer versions of Python
history
pyupgrade is a Python source modernizer, usable directly or as a pre-commit hook, that rewrites syntax and compatibility patterns when newer Python versions are permitted.
Anthony Sottile developed pyupgrade as a command-line program and pre-commit hook for automatically modernizing Python syntax. The project accumulated transformations for language changes ranging from set literals and f-strings to removal of Python 2 compatibility constructs and outdated standard-library aliases.
The tool follows an explicit-target model: maintainers select flags such as `--py36-plus` or later equivalents so rewrites are constrained by the minimum Python version their project supports.
pyupgrade became available across several packaging ecosystems, including PyPI, Homebrew, Debian and Ubuntu, MacPorts, Arch Linux, and Nix. Its official pre-commit hook also made it straightforward to apply automatically during commits.
Users run `pyupgrade` against Python files or configure its official pre-commit hook. Minimum-version flags enable transformations that would be unsafe for older interpreters.
Typical use accompanies a minimum-supported-Python bump, removes redundant compatibility code, and modernizes constructs such as formatting expressions, imports, type declarations, and standard-library aliases.
pyupgrade captures Python-version migration knowledge as repeatable source transformations. Package maintainers value it because raising a project's minimum Python version can be followed by a mechanical cleanup of obsolete compatibility syntax, imports, and idioms.
security posture
narrow executable package without higher-risk signals.
green risk · low confidence · appliance
Before unattended agent use, check whether the tool reads plaintext credentials, writes remote state, publishes artifacts, or shells out to plugins.
executables
| Command | Kind | Exposure | Note |
|---|---|---|---|
pyupgrade | cli | global executable |
freshness
These signals separate page generation age, package-manager activity, and upstream release comparison. Version lag is warned only when an evidence URL and comparable versions are present.
https://github.com/asottile/pyupgrade
install metadata
| Package key | brew:pyupgrade |
|---|---|
| Version | 3.21.2 |
| Package manager | Homebrew |
| Package manager page | https://formulae.brew.sh/formula/pyupgrade |
| Homepage | https://github.com/asottile/pyupgrade |
| Repository | https://github.com/asottile/pyupgrade |
| License | MIT |
| Source archive | https://files.pythonhosted.org/packages/7f/a1/dc63caaeed232b1c58eae1b7a75f262d64ab8435882f696ffa9b58c0c415/pyupgrade-3.21.2.tar.gz |
| Dependencies | python@3.14 |
| Bottle | available (on all) |
| Homebrew post-install | not defined |
| Service | none declared |
registry facts
| Source Database | Homebrew formula API |
|---|---|
| Tap | homebrew/core |
| Full Name | pyupgrade |
| Version Scheme | 0 |
| Revision | 0 |
| Head Version | HEAD |
| Bottle Stable Root URL | https://ghcr.io/v2/homebrew/core |
| Deprecated | no |
| Disabled | no |
| Keg Only | no |
| URL Keys |
|
source database matches
Matches are pulled from external package-manager indexes and kept separate from local Automic Vault package links.
pyupgrade 3.19.1-1
Tool to automatically upgrade Python 3 syntax for newer versions
https://github.com/asottile/pyupgrade
sudo apt install pyupgradepyupgrade
nix profile install nixpkgs#pyupgradepyupgrade 2.37.1-2
Tool to automatically upgrade Python 3 syntax for newer versions
https://github.com/asottile/pyupgrade
sudo apt install pyupgradepyupgrade 3.21.2-1
A tool to automatically upgrade syntax for newer versions of the language
https://github.com/asottile/pyupgrade
sudo pacman -S pyupgradepyupgrade
sudo port install pyupgradesource trail
This page is generated by av-web from the private package SQLite artifact built by scripts/generate-pkg-sqlite.py.
View the package source record on GitHub.