Python: Unify dev and release bootstrap for openrewrite package#6839
Merged
knutwannheden merged 5 commits intomainfrom Feb 27, 2026
Merged
Python: Unify dev and release bootstrap for openrewrite package#6839knutwannheden merged 5 commits intomainfrom
openrewrite package#6839knutwannheden merged 5 commits intomainfrom
Conversation
openrewrite installed for dev builds
The bootstrap logic now works the same for dev pre-releases (e.g., 8.75.0.dev0) and stable releases: 1. If pipPackagesPath is set, check for a version-specific install there 2. If the interpreter already has the right version, use it as-is 3. Otherwise install via pip to pipPackagesPath (or fail if not set) This eliminates the stale `dev/` directory that previously installed an unpinned PyPI release and never updated it. Dev pre-releases are now installed to version-specific subdirectories like stable releases. For local development without a version file (version is empty), the interpreter must already have the rewrite package available (e.g., via `uv sync --extra dev` in rewrite-python/rewrite/).
fd2c282 to
746fe6e
Compare
openrewrite installed for dev buildsThe .dev0 suffix indicates a local dev build that isn't published to PyPI, so attempting `pip install openrewrite==X.Y.Z.dev0` will always fail. Restore the dev build check so these versions require the interpreter to already have the package (e.g. via editable install). Also improve pip install error messages to include the version being installed and capture pip output on failure.
…ests Handle Gradle's "unspecified" version (used in IDE runs) the same as .dev0 — require the interpreter to already have the rewrite package rather than attempting to pip-install a non-existent version. Also remove ad-hoc paramiko/fabric parsing tests that were committed by mistake.
CI builds produce timestamped versions like 8.75.0.dev20260227100441
which are also not published to PyPI. Use .contains(".dev") instead
of .endsWith(".dev0") to catch all PEP 440 dev versions.
Timestamped .dev versions (e.g., 8.75.0.dev20260227100441) are real publishable pre-releases, not local dev builds. When the exact version isn't found and pipPackagesPath isn't set, fall back to checking if the interpreter can import rewrite at all. This handles CI test runs where the venv has an editable install that doesn't match the timestamped version.
openrewrite package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Python RPC bootstrap logic previously had separate paths for dev and release builds. For dev builds, it ran
pip install openrewrite(unpinned) into adev/directory, which installed whatever version was latest on PyPI and never updated it — leading to stale release code silently running in a development context.The bootstrap is now unified for both dev pre-releases (e.g.,
8.75.0.dev0) and stable releases:pipPackagesPathis set, check for a version-specific install there (e.g.,8.75.0.dev0/)pip install openrewrite==<version>topipPackagesPathpipPackagesPathis not set and the interpreter doesn't have the right version, fail with an actionable errorThis eliminates the
dev/directory entirely. Dev pre-releases published to PyPI are now installed to version-specific subdirectories just like stable releases.Developer setup
For local development (when no version file is present), the interpreter must already have the
rewritepackage importable. Set up the venv:cd rewrite-python/rewrite uv sync --extra devThis creates a
.venvwith an editable install pointing at the local source tree. Then either:pythonPathto.venv/bin/python, orTest plan