Skip to content

make --find-interpreter skip prerelease Python unless --allow-prereleases - #3276

Open
tientnc wants to merge 2 commits into
PyO3:mainfrom
tientnc:allow-prereleases
Open

make --find-interpreter skip prerelease Python unless --allow-prereleases#3276
tientnc wants to merge 2 commits into
PyO3:mainfrom
tientnc:allow-prereleases

Conversation

@tientnc

@tientnc tientnc commented Jul 23, 2026

Copy link
Copy Markdown

What does this PR do?

  • Makes --find-interpreter skip prerelease (alpha/beta/rc) Python interpreters, by default, with a --allow-prereleases flag to opt back in
  • The interpreter probe script now collects sys.version_info.releaselevel; each discovered interpreter is tagged as prerelease or not, and the resolver drops prereleases (printing a notice for each) unless --allow-prereleases is passed
  • Interpreters named explicitly with -i are never filtered, since naming one is already an opt-in

Note: this changes the default behavior of --find-interpreter: prereleases are now skipped unless opted in (which is the behavior asked for in the issue).

Why was this PR needed?

--find-interpreter builds a wheel for every discovered interpreter with no distinction between a final release and a prerelease, which risks accidentally publishing prerelease wheels to PyPI (e.g. in CI). Root cause: the probe script (get_interpreter_metadata.py) never collected releaselevel, so InterpreterMetadataMessage had no field for it and nothing in the Rust discovery path could act on it. Therefore, the fix starts at collection and threads the value through to the resolver, where the skip decision has access to the user's flags.

What are the relevant issue numbers?

Closes #1975

Does this PR meet the acceptance criteria?

  • Tests added for new/changed behavior (test_interpreter_releaselevel_marks_prerelease)
  • All tests passing (python_interpreter + build_options suites; cargo fmt --check + clippy clean)
  • Follows project style guide
  • No breaking changes introduced (additive field/flag; default of --find-interpreter now skips prereleases, as requested in the issue)

@tientnc

tientnc commented Jul 23, 2026

Copy link
Copy Markdown
Author

The one red check, Test (windows-11-arm, 3.15-dev), failed during environment setup, before the build or test steps ran, with:

Fatal error. Internal CLR error. (0x80131506)
pwsh.exe failed with exit code 3221225477   # 0xC0000005, access violation

This happened while extracting a tool archive on the ARM Windows runner, so it looks like a transient runner issue rather than anything in this change. The same 3.15-dev path passes on Test (ubuntu-22.04-arm, 3.15-dev). I suppose that job can be re-run when convenient? Happy to rebase or adjust if you'd prefer!

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.

Make --find-interpreter require opt-in to prereleases

1 participant