Scope PYTHON_GIL=0 off the PyPI publish job - #310
Merged
Conversation
Keep free-threaded GIL=0 on gate/build only, never workflow-wide or on pypa/gh-action-pypi-publish, matching the shared Trusted Publishing rule.
There was a problem hiding this comment.
Pull request overview
This PR tightens the GitHub Actions release-to-PyPI workflow so PYTHON_GIL=0 is only applied to the free-threaded (3.14t) gate/build jobs, and is never inherited by the pypa/gh-action-pypi-publish upload job (which is incompatible with PYTHON_GIL=0).
Changes:
- Scope
PYTHON_GIL: "0"torelease-gateandrelease-buildjob-levelenvin.github/workflows/python-publish.yml, avoiding any workflow-wide inheritance. - Add a regression test ensuring
pypi-publishdoes not seePYTHON_GILand that the workflow documents the rule. - Add a changelog fragment documenting the Trusted Publishing / free-threaded scoping rule.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/templates/test_github_report_contracts.py | Adds a contract test to ensure PYTHON_GIL is not set at workflow scope and is absent from pypi-publish. |
| changelog.d/+pypi-gil-scoping.changed.md | Documents the Trusted Publishing scoping behavior for PYTHON_GIL=0. |
| .github/workflows/python-publish.yml | Moves PYTHON_GIL=0 to job scope for gate/build and ensures publish job does not inherit it; expands documentation of the rule. |
| """pypa upload container is not free-threaded; GIL=0 belongs on our jobs only.""" | ||
| workflow = (WORKFLOWS_DIR / "python-publish.yml").read_text(encoding="utf-8") | ||
|
|
||
| assert "\nenv:\n PYTHON_GIL:" not in workflow |
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
PYTHON_GIL=0on free-threaded gate/build jobs onlypypi-publishTest plan
PYTHON_GILpypi-publishhas noPYTHON_GIL