{"categories":[{"label":"Quality Assurance","url":"https://skillfed.io/packages/category/software-development-quality-assurance"}],"enrichment":{"capability":"Automatically rewrites Python source code to use newer syntax patterns, removing deprecated constructs and modernizing code style across set literals, comprehensions, string formatting, and class definitions.","skillfed_tags":["code-modernization","pre-commit-hook","syntax-rewriter"],"use_cases":["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` \u2192 `assertEqual`) from test suites","Simplify class definitions by removing unnecessary `object` inheritance and rewriting metaclass declarations"],"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.\n\nIt 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.","worth_installing":"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."},"id":"pyupgrade","links":{"html":"https://skillfed.io/packages/pyupgrade","md":"https://skillfed.io/packages/pyupgrade.md","pypi":"https://pypi.org/project/pyupgrade/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-11-19","license_spdx":null,"license_treatment":"permissive","name":"pyupgrade","python_support":"supports_current","summary":"A tool to automatically upgrade syntax for newer versions."},"popularity":{"monthly_downloads":1860922,"position":3483,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"3.21.2"}
