Skip to content

Python: Isolate openrewrite package by version and add recipeInstallDir#6824

Merged
jkschneider merged 1 commit intomainfrom
python-version-isolated-packages
Feb 26, 2026
Merged

Python: Isolate openrewrite package by version and add recipeInstallDir#6824
jkschneider merged 1 commit intomainfrom
python-version-isolated-packages

Conversation

@knutwannheden
Copy link
Contributor

Summary

  • Resolves a version-specific subdirectory under pipPackagesPath (e.g., <basePath>/0.5.3/) so different openrewrite package versions don't overwrite each other. Two CLI versions shipping the same openrewrite package version share the directory — no duplication.
  • Adds recipeInstallDir(Path) to PythonRewriteRpc.Builder for a separate shared directory containing user-installed recipe packages (added to PYTHONPATH alongside the version-specific openrewrite directory). Mirrors recipeInstallDir on the JavaScript RPC builder.

Context

When multiple Moderne CLI versions share ~/.moderne/cli, they conflict over the openrewrite Python package — one version can break another. Currently both the openrewrite package (bootstrapped by the RPC) and user-installed recipe packages live in a single shared directory.

After this change, the layout becomes:

~/.moderne/cli/python/openrewrite/<package-version>/
  rewrite/                    ← version-specific
~/.moderne/cli/recipes/pip/
  rewrite_recipe_example/     ← shared across CLI versions

Test plan

  • Verify existing Python recipe tests still pass
  • Verify bootstrapOpenrewrite installs into the version-specific subdirectory
  • Verify recipeInstallDir is added to PYTHONPATH when set

…ir to Builder

When multiple CLI versions share the same home directory, they conflict
over the openrewrite Python package. This change resolves that by:

1. Resolving a version-specific subdirectory under pipPackagesPath
   (e.g., `<basePath>/0.5.3/`) so different openrewrite versions
   don't overwrite each other. Two CLI versions shipping the same
   openrewrite package version share the directory.

2. Adding a `recipeInstallDir` builder method for a separate shared
   directory containing user-installed recipe packages (added to
   PYTHONPATH alongside the version-specific openrewrite directory).
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Feb 26, 2026
@jkschneider jkschneider merged commit 78d3500 into main Feb 26, 2026
1 check passed
@jkschneider jkschneider deleted the python-version-isolated-packages branch February 26, 2026 08:51
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants