GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - openrewrite/rewrite-python: OpenRewrite recipes for Python.

This repository was archived by the owner on Jan 13, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

837 Commits
837 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
.run
.run
 
 
.vscode
.vscode
 
 
LICENSE
LICENSE
 
 
gradle
gradle
 
 
rewrite-python-remote
rewrite-python-remote
 
 
rewrite-python
rewrite-python
 
 
rewrite-test-engine-remote
rewrite-test-engine-remote
 
 
rewrite
rewrite
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle.kts
build.gradle.kts
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle.kts
settings.gradle.kts
 
 

Repository files navigation

OpenRewrite Logo

rewrite-python

ci Maven Central Revved up by Gradle Enterprise Contributing Guide

Introduction

This repository is a work-in-progress implementation of OpenRewrite Python language support.

Note: For now, this language and the associated recipes are only supported via the Moderne CLI or the Moderne Platform (at least until native build tool support catches up). That being said, the Moderne CLI is free to use for open-source repositories. If your repository is closed-source, though, you will need to obtain a license to use the CLI or the Moderne Platform. Please contact Moderne to learn more.

Getting started

For help getting started with the Moderne CLI, check out our getting started guide. Or, if you'd like to try running these recipes in the Moderne Platform, check out the Moderne Platform quickstart guide.

Contributing

We appreciate all types of contributions. See the contributing guide for detailed instructions on how to get started.

Development information

Implementation progress

This is largely based on the Python grammar specification.

Parser development and testing

The Python parser is being implemented in Python, but its printer is implemented in Java. So regardless of whether the tests are written in Java or in Python, both a Python and a Java process are required to validate the parser's results. As we already have plenty of tests written in Java, this section describes how to run these and also debug the parser. Thus, the idea is to run OpenRewrite JUnit tests, which behind the scenes parse the Python sources using a Python application, where the two applications communicate via TCP sockets (using the LST remoting protocol). In the setup described here it is at the time of writing important that the GitHub repos are cloned in a organization/repo structure.

  1. Clone both moderneinc/rewrite-remote and openrewrite/rewrite-python (here we are assuming ~/git to be the parent directory)
    mkdir -p ~/git/moderneinc && gh repo clone moderneinc/rewrite-remote ~/git/moderneinc/rewrite-remote
    mkdir -p ~/git/openrewrite && gh repo clone openrewrite/rewrite-python ~/git/openrewrite/rewrite-python
  2. Make sure Python 3.12 and Uv are installed
    brew install uv
    cd ~/git/openrewrite/rewrite-python/rewrite
    uv python install
  3. Create a Python virtual environment and activate it
    cd ~/git/openrewrite/rewrite-python/rewrite
    uv sync --all-extras
    source ./.venv/bin/activate
  4. Switch to moderneinc/rewrite-remote/python and install all dependencies using Uv
    cd ~/git/moderneinc/rewrite-remote/python/rewrite-remote
    uv build
  5. Open ~/git/openrewrite/rewrite-python/rewrite in IDEA (or PyCharm)
    idea ~/git/openrewrite/rewrite-python/rewrite
  6. Make sure that the Python plugin is installed and also that the interpreter from the created venv is configured and used
  7. Create a new run configuration which runs the Python module rewrite_remote.server (typically in debug mode)
  8. Now open ~/git/openrewrite/rewrite-python in a second IDEA workspace and run the JUnit tests from there

PyCharm setup

(tested using PyCharm 2024.3.1.1 (Community Edition))

In order to conveniently perform development and run tests from within PyCharm one can:

  1. Open the ~/git/openrewrite/rewrite-python/rewrite as project.
  2. Configure the virtual environment interpret with:
    • PyCharm | Settings | Project: rewrite-python | Python Interpreter | Add Interpreter | Add Local Interpreter
    • Select Existing
    • Python path - navigate to ~/git/openrewrite/rewrite-python/rewrite/.venv/bin/python
  3. (Right-click to) mark the top directory as Sources Root (not rewrite/ subdirectory)
  4. (Right-click to) mark rewrite/tests/python/all as Test Sources Root

Resources

  • Python Builtins, which are sometimes used to desugar syntax.
  • Python Magic Methods (aka "dunders"), also used for desugaring.

About

OpenRewrite recipes for Python.

Topics

openrewriteopenrewrite-recipes

Resources

Readme

Contributing

Contributing
Activity
Custom properties

Stars

33 stars

Watchers

8 watching

Forks

7 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.