-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
📦 Pass desired release to PEP 517 tox env #13933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📦 Pass desired release to PEP 517 tox env #13933
Conversation
This patch fixes passing the release version string from the release automation script to the tox's PEP 517 frontend, so that the backend machinery bits (namely, `setuptools-scm`) could access the environment variable; as indentified in the attempt to release pytest v9.0.1 [[1]]. The solution uses the `[pkgenv]` section of `tox.ini` that corresponds to the PEP 517 build env tox manages internally. [1]: https://github.com/pytest-dev/pytest/pull/13928/files#r2514197778
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the release automation to properly pass the version string to the PEP 517 build environment managed by Tox. The key issue was that setuptools-scm needs access to the SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST environment variable during the wheel build process, not just during test execution.
- Moved
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTESTfrom[testenv]to[pkgenv]section to make it available during PEP 517 build - Removed redundant
passenvdeclarations from specific testenvs ([testenv]and[testenv:regen]) - Added comprehensive documentation comments explaining the
[pkgenv]section usage and workarounds for tox v4.14.1 regression
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tox.ini | Restructured environment variable passing to make version string available in PEP 517 build environment instead of only in test environments |
| changelog/13933.packaging.rst | Added changelog entry for the packaging fix (contains an error in content) |
| changelog/13933.contrib.rst | Contains the actual changelog content describing the tox configuration change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bluetech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for investigating this!
| # * https://github.com/tox-dev/tox/pull/3237 | ||
| # * https://github.com/tox-dev/tox/issues/3238 | ||
| # * https://github.com/tox-dev/tox/issues/3292 | ||
| # * https://hynek.me/articles/turbo-charge-tox/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I learned through this article that we might not need coverage-enable-subprocess anymore. I think I'll try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluetech not sure but I tend to use pytest-cov that definitely doesn't.
FTR, I'm looking more into this and the change might be incomplete. |
|
I made an experimental branch here, in the upstream repo and triggered the workflow from it: https://github.com/pytest-dev/pytest/actions/runs/19276090877/job/55116123406. I cherry-picked this change in there on top of 9.0.x — let's see how it performs before merging. |
|
Urgh.. I didn't trigger it the right way. Here's a proper run: https://github.com/pytest-dev/pytest/actions/runs/19276169030/job/55116378101#step:5:406. It does help with the docs diff. The outer invocation still uses the Git-generated version: https://github.com/pytest-dev/pytest/actions/runs/19276169030/job/55116378101#step:5:24. But that is to be expected — the job itself invoking tox directly doesn't set this var. |
|
Oh, it actually updated the existing release PR, proving that this works: https://github.com/pytest-dev/pytest/pull/13928/files#diff-0e43a7f1313ac690564ffafd9a994c5a7faba686ad62c2ea327dab13614dfc8cR23. |
Backport to 9.0.x: 💚 backport PR created✅ Backport PR branch: Backported as #13935 🤖 @patchback |
…tuptools-scm-pretend-env-var 📦 Pass desired release to PEP 517 tox env (cherry picked from commit ce8b8a7)
…e8b8a7b4b360ac5f3953b8c3b8b59e6bb420f37/pr-13933 [PR #13933/ce8b8a7b backport][9.0.x] 📦 Pass desired release to PEP 517 tox env
This patch fixes passing the release version string from the release automation script to the tox's PEP 517 frontend, so that the backend machinery bits (namely,
setuptools-scm) could access the environment variable; as indentified in the attempt to release pytest v9.0.1 [1].The solution uses the
[pkgenv]section oftox.inithat corresponds to the PEP 517 build env tox manages internally.