awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
asottile avatar

asottile/pyupgrade

0
View on GitHub↗

Pyupgrade

pyupgrade is a static code modernizer and syntax upgrader for Python. It automatically rewrites source code to implement modern language features and syntax based on a specified target version.

The tool focuses on removing technical debt by deleting deprecated imports, compatibility shims, and obsolete version-specific conditional blocks. It also refactors type annotations to use current standards, such as simplified generic aliases and union operators.

Its capability surface includes updating standard library usage, optimizing built-in function calls, and converting verbose collection constructors or string formatting into concise modern equivalents. These transformations are performed via a target-versioned rule engine that preserves original formatting and comments.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Features

  • Python Syntax Modernizers - Automatically rewrites Python source code to implement modern language features and syntax based on a specified target version.
  • Python Code Modernizers - Removes technical debt by deleting deprecated imports, compatibility shims, and obsolete version-specific conditional blocks.
  • Dead Code Removal - Automatically deletes obsolete imports, encoding comments, and version-specific conditional blocks that are no longer needed.
  • Type Hint Refactoring - Refactors type annotations to use modern standards such as simplified generic aliases and union operators.
  • Language Version Targeting - Executes specific transformation rules based on a user-defined target Python version to ensure language compatibility.
  • Type Annotation Modernization - Updates Python type hinting syntax by removing quoted annotations and applying simplified generic aliases.
  • Type Annotation Refactoring - Updates Python typing syntax to use modern standards such as built-in collection types and union operators.
  • Python Refactoring Libraries - Provides automated refactoring of outdated type hinting syntax into modern generic aliases and union operators.
  • Structural Pattern Matching - Identifies outdated code sequences and replaces them with modern equivalents through precise tree-node substitution.
  • Compatibility Shim Removal - Deletes obsolete future imports, compatibility library calls, and version check blocks no longer required for the target version.
  • Python Code Modernization - Updates legacy Python source code to use newer language features and syntax based on a target version.
  • Python Syntax Optimization - Replaces verbose library calls and outdated string formatting with concise and efficient modern Python equivalents.
  • Python Technical Debt Reduction - Removes deprecated imports, version compatibility shims, and obsolete code blocks no longer needed in newer environments.
  • Concrete Syntax Tree Transformations - Implements transformations on concrete syntax trees to ensure that original source formatting and comments are preserved during rewriting.
  • AST Transformation Tools - Uses a concrete syntax tree to apply precise structural changes while preserving formatting and comments.
  • Multi-Pass Rewriting - Employs sequential transformation cycles to resolve complex, interdependent syntax upgrades in a single execution.
  • Deprecated Import Normalization - Updates outdated module imports and replaces deprecated aliases with current standard library paths.
  • Standard Library API Migration - Replaces deprecated function aliases and outdated argument patterns with current Python standard library equivalents.
  • Standard Library API Simplification - Cleans up common standard library API usage to reduce verbosity and improve code readability.
  • String Formatting Modernization - Transforms printf-style and method-based strings into modern formatted string literals or simplified specifiers.
  • Python Literal Syntax Enforcement - Enforces the use of idiomatic Python literal syntax over verbose constructor calls for sets and dictionaries.
  • Code Refactoring - Automatically updates syntax to use modern language features.
4,126 stars·229 forks·Python·MIT·22 views

Star history

Star history chart for asottile/pyupgradeStar history chart for asottile/pyupgrade

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

Projects sharing features with Pyupgrade

These projects share indexed features with Pyupgrade. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • adamchainz/django-upgradeadamchainz avatar

    adamchainz/django-upgrade

    1,214View on GitHub↗

    Django-upgrade is a command-line tool that automatically modernizes legacy Python and Django codebases by rewriting outdated syntax patterns into current idioms. It operates as a static analysis linter and source code transformation engine, parsing files to identify deprecated constructs and replacing them in place while preserving project integrity. The software uses a rule-based transformation architecture driven by abstract syntax tree parsing to execute modular refactoring tasks. Developers can configure target version settings to ensure the tooling only applies updates appropriate for th

    Pythondjango
    View on GitHub↗1,214
  • davidhalter/jedidavidhalter avatar

    davidhalter/jedi

    6,186View on GitHub↗

    Awesome autocompletion, static analysis and refactoring library for python

    Python
    View on GitHub↗6,186
  • google/yapfgoogle avatar

    google/yapf

    13,978View on GitHub↗

    YAPF is a Python code formatter and style compliance tool. It operates as an AST-based reformatter that uses concrete syntax trees to ensure structural consistency and a uniform visual presentation across source files. The engine utilizes a penalty-based layout optimizer to determine the best line breaks by calculating numerical costs for different formatting choices. It employs a multi-process code processor to distribute the formatting of multiple files across several CPU cores. The tool covers source code reformatting through in-place file modifications, difference analysis, and the proce

    Python
    View on GitHub↗13,978
  • python-mode/python-modepython-mode avatar

    python-mode/python-mode

    5,463View on GitHub↗

    python-mode is a Vim IDE plugin that provides an integrated toolset for Python development. It incorporates a debugging interface for managing execution breakpoints and inspecting program state, a documentation browser for retrieving official language symbols, and a system for static analysis and automated structural refactoring. The project features a dedicated environment manager that detects and utilizes project-specific virtual environments to ensure correct library and interpreter resolution. It integrates external tools such as PyLint and Rope to identify code errors and perform project

    Vim Script
    View on GitHub↗5,463
Compare all 30 related projects→

Frequently asked questions

What does asottile/pyupgrade do?

pyupgrade is a static code modernizer and syntax upgrader for Python. It automatically rewrites source code to implement modern language features and syntax based on a specified target version.

What are the main features of asottile/pyupgrade?

The main features of asottile/pyupgrade are: Python Syntax Modernizers, Python Code Modernizers, Dead Code Removal, Type Hint Refactoring, Language Version Targeting, Type Annotation Modernization, Type Annotation Refactoring, Python Refactoring Libraries.

Which projects share features with asottile/pyupgrade?

Projects with overlapping indexed features include: adamchainz/django-upgrade — Django-upgrade is a command-line tool that automatically modernizes legacy Python and Django codebases by rewriting… davidhalter/jedi — Awesome autocompletion, static analysis and refactoring library for python. python-mode/python-mode — python-mode is a Vim IDE plugin that provides an integrated toolset for Python development. It incorporates a… google/yapf — YAPF is a Python code formatter and style compliance tool. It operates as an AST-based reformatter that uses concrete… postcss/postcss — PostCSS is a CSS post-processor and abstract syntax tree transformation tool that parses stylesheets into a structured… facebook/jscodeshift — jscodeshift is a JavaScript AST transformation toolkit and codemod engine designed for large-scale code refactoring…