Skip to content

Test on the oldest and newest supported Python in CI - #55

Merged
morisil merged 2 commits into
issue-11-venv-pythonfrom
issue-35-ci-python-matrix
Nov 10, 2026
Merged

morisil merged 2 commits into
issue-11-venv-pythonfrom
issue-35-ci-python-matrix

Conversation

@morisil

@morisil morisil commented Nov 9, 2026

Copy link
Copy Markdown
Member

Fixes #35

Stacked on #51 (issue-11-venv-python, the configurable base Python of the test venv) — merge #51 first; this PR's own change is issue-11-venv-python..issue-35-ci-python-matrix.

Fix

CI ran the tests only with the runner's default Python, so nothing ran jep, PLAN or the environment probe on a real 3.10, the minimum the README states.

  • New workflow .github/workflows/build-python.yml (pull requests and pushes to main): a matrix over Python 3.10 (the oldest supported by jep) and 3.14 (the newest verified with the pinned jep), fail-fast: false.
    Each leg: checkout, setup-java (the same vars.DEFAULT_JAVA_* as the shared workflow), setup-python, setup-gradle, then ./gradlew test with ORG_GRADLE_PROJECT_basePython set to the setup-python interpreter — so the test venv is created from it and jep compiled against it.
  • A separate workflow because the shared xemantic/.github build-gradle.yml cannot set up Python; build-pr.yml / build-main.yml are unchanged, so main still publishes exactly once.
  • concurrency cancels superseded PR runs, never main pushes.
  • DEVELOPMENT.md describes the matrix and how to bump it, and that a Python outside the system library directories needs its lib on LD_LIBRARY_PATH (uv), or a shared build (pyenv --enable-shared) — actions/setup-python sets LD_LIBRARY_PATH on Linux. CLAUDE.md gains the gotcha that a running Gradle daemon does not pass a changed LD_LIBRARY_PATH to the test JVM.

Verification

GitHub Actions cannot run locally, so the workflow will first run on this PR. Locally:

  • actionlint 1.7.7 is clean for all workflows.
  • The suite passes on a real CPython 3.10.22 (fresh .venv created from it through -PbasePython, jep compiled against it) — run by both the fixer and the reviewer — and on 3.14.10.
  • Without LD_LIBRARY_PATH, 35 of 62 tests fail with libpython3.10.so.1.0: cannot open shared object file — CI is covered by setup-python (src/find-python.ts of v7), the user-facing side is filed as jep cannot load libpython of a Python outside the system library directories on Linux #54.

Review

  • Round 1 (/code-review, independent reviewer): no blocking findings. Minor findings applied in 2d74af2: pyenv advice, CLAUDE.md deduplicated, test instead of a full build per leg, "newest verified" wording, a concurrency group.

Follow-ups filed

🤖 Generated with Claude Code

https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

morisil and others added 2 commits November 9, 2026 22:25
A matrix job sets up Python 3.10 and 3.14 with actions/setup-python
and creates the test venv from it via ORG_GRADLE_PROJECT_basePython,
as the shared reusable workflow cannot set up Python. It runs next to
the shared build, which keeps publishing from main exactly once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG
Test with the newest Python verified with the pinned jep rather than
"the latest", correct the pyenv advice (it needs --enable-shared), and
keep in CLAUDE.md only the Gradle daemon LD_LIBRARY_PATH gotcha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG
@morisil
morisil merged commit 2d58487 into issue-11-venv-python Nov 10, 2026
3 checks passed
@morisil
morisil deleted the issue-35-ci-python-matrix branch November 10, 2026 17:04
morisil added a commit that referenced this pull request Nov 10, 2026
…v's version (#51)

* Make the base Python of the test venv configurable and check its version (#11)

createPythonVenv used python3 from the PATH of the Gradle daemon,
which can be an old Python, e.g. the one of Xcode on macOS,
failing only later, when pip finds no matching jep.
The base Python can now be set with the basePython Gradle property
(also ORG_GRADLE_PROJECT_basePython, for CI),
and a Python older than 3.10 fails with a clear message before the venv is created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

* Validate an existing test venv and recreate it when its base Python changed (#11)

An existing .venv skipped the version check, so a venv already created by an old
Python kept failing on jep. The base Python is now checked on every build,
isolated (-I), with the comparison done by Python itself, a failing Python
reported with its stderr. The base Python and its version are recorded in
.venv/base-python.txt after a successful creation, and .venv is created again
when the record is missing (a pre-existing or half-made venv, e.g. without pip
when ensurepip is unavailable) or differs. A failed creation deletes the
half-made .venv and reports the output of venv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

* Judge the test venv by its own Python, keep it unless basePython is set (#11)

A daemon whose python3 differs from the one of the shell, e.g. of an IDE,
failed the build or recreated a working .venv. Now .venv is kept when its own
Python runs, is 3.10 or newer, and has pip; only then is python3 not checked at
all. A chosen basePython also recreates .venv when it is of another base
Python, compared by the prefix and version of the interpreters, not by paths.
The previous .venv is moved aside while creating the new one and restored when
that fails, deleted without following symbolic links. The recorded base Python
is an input of the tests, so they rerun on another one. A base Python failing
to run, like Python 2 rejecting -I, is reported with the required version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

* Restore the previous test venv on any failure, treat a blank basePython as unset (#11)

An empty basePython, like an empty value of a CI matrix, now means python3 with
the existing .venv kept. The previous .venv is restored on any failure of the
creation, also an exception or a cancelled build, and a .venv.previous left by
a killed build is restored on the next one instead of deleted. A venv with a
dangling python is reported as incomplete, not as created anew, and the comment
on -I no longer claims it skips sitecustomize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

* Test on the oldest and newest supported Python in CI (#55)

* Build on CI with the minimum and the latest supported Python (#35)

A matrix job sets up Python 3.10 and 3.14 with actions/setup-python
and creates the test venv from it via ORG_GRADLE_PROJECT_basePython,
as the shared reusable workflow cannot set up Python. It runs next to
the shared build, which keeps publishing from main exactly once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

* Run only the tests in the Python matrix, cancel superseded PR runs (#35)

Test with the newest Python verified with the pinned jep rather than
"the latest", correct the pyenv advice (it needs --enable-shared), and
keep in CLAUDE.md only the Gradle daemon LD_LIBRARY_PATH gotcha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant