Python Pyupgrade Syntax Modernizer

Upgrade deprecated Python syntax to newer constructs for a target version.

Updated Jan 12, 2026
One-click install
npx skills add https://github.com/drdave-flexnetos/ripple-env --skill python-pyupgrade-syntax-modernizer-drdave-flexnetos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Python Pyupgrade Syntax Modernizer
Source: https://github.com/drdave-flexnetos/ripple-env/tree/main/.claude/skills/python-pyupgrade-tool
Command: npx skills add https://github.com/drdave-flexnetos/ripple-env --skill python-pyupgrade-syntax-modernizer-drdave-flexnetos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Python version migrations are slow and error-prone because developers must manually refactor deprecated or older syntax to match a newer Python minimum version.

Core Features & Use Cases

  • Version-targeted syntax upgrades: Apply safe, conservative transformations based on flags like --py311-plus to match your team’s target runtime.
  • Common modernization tasks: Remove legacy patterns such as class Foo(object), outdated imports, old string formatting, obsolete future imports, and older typing syntax.
  • Gradual codebase migration: Use pyupgrade in place across individual files or recursively across a repository, then review diffs before merging.

Use case example: Migrating a ROS-related Python package to Python 3.11 by removing old formatting and updating typing hints so the codebase compiles cleanly under the new minimum version.

Quick Start

Run pyupgrade on your Python file targeting Python 3.11+ by executing: pyupgrade --py311-plus your_module.py.

Frequently Asked Questions about Python Pyupgrade Syntax Modernizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically convert old Python string formatting to f-strings?

Python syntax modernization automatically transforms outdated string formatting into f-strings. By targeting a specific Python version, it safely refactors legacy formatting patterns across individual files or recursive directories.

What is the best way to remove obsolete Python syntax like __future__ imports during a migration?

Python syntax modernization removes obsolete patterns like __future__ imports and class Foo(object) declarations. It applies deterministic transformations to upgrade your codebase to match your chosen minimum Python runtime version.

Can I modernize type hints to use generics and unions for a Python 3.11 migration?

Type hints modernization updates older typing syntax to use newer constructs like generics and unions. You apply version-targeted flags, such as --py311-plus, to safely refactor type annotations across your repository.

How do I run pyupgrade recursively across an entire repository?

Python syntax modernization supports recursive directory processing to apply pyupgrade transformations across a repository. You execute the tool with version-specific flags to refactor multiple files deterministically before reviewing diffs.

Does pyupgrade modify code deterministically without breaking functionality?

Python syntax modernization applies pyupgrade transformations safely and deterministically using appropriate --pyXX-plus flags. It performs conservative syntax upgrades, allowing you to review diffs before merging the refactored code.

When do I need to use version-targeted flags for Python syntax modernization?

Version-targeted flags for Python syntax modernization are needed when applying transformations to match a specific minimum Python version. Flags like --py311-plus ensure only safe, appropriate syntax upgrades are applied for your target runtime.