pyupgrade is a tool that automatically upgrades Python syntax to match newer language versions.
The tool addresses the friction of manually updating codebases to take advantage of modern Python features. It works by parsing Python source files and rewriting them to use contemporary syntax and idioms, eliminating patterns that have been superseded by language improvements. This allows developers to adopt newer Python versions without the tedious work of identifying and refactoring each outdated construct individually. The tool integrates with pre-commit frameworks, making it straightforward to apply these upgrades as part of standard development workflows.
The tool suits projects that want to maintain compatibility with a specific minimum Python version while progressively modernizing their codebase. It is particularly valuable for libraries and frameworks that need to support multiple Python versions, as it can be configured to target a particular version floor and automatically upgrade everything that version supports. Teams should adopt it when they are ready to drop support for older Python versions and want an automated way to surface and apply the corresponding syntax improvements across their entire codebase.
The project shows consistent, focused development activity with regular updates that expand the set of syntax patterns it can upgrade. Maintenance is responsive to issues and pull requests, indicating active stewardship. The tool has accumulated a stable set of features rather than pursuing rapid expansion, suggesting the maintainer prioritizes reliability and correctness over adding marginal capabilities. Development remains concentrated on the core mission of syntax modernization without scope creep into adjacent linting or formatting concerns.