[PR #15023/de30d841 backport][9.1.x] feat(packaging): version git archives of arbitrary commits - #15025
Merged
webknjaz merged 1 commit intoSep 15, 2026
Conversation
feat(packaging): version git archives of arbitrary commits (cherry picked from commit de30d84)
webknjaz
approved these changes
Sep 15, 2026
webknjaz
deleted the
patchback/backports/9.1.x/de30d8417f3d93bc0c16fc0a64092e197c46e36a/pr-15023
branch
September 15, 2026 07:54
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.
This is a backport of PR #15023 as merged into main (de30d84).
Closes #11680.
GitHub serves a source tarball for every commit, not only for tags, but so far only a tag's tarball could be built — without a
.gitdirectorysetuptools-scmhad nothing to read a version from.This adds a
.git_archival.txtexpanded bygit archiveviaexport-subst.It uses the stable template —
node,node-date,describe-name, deliberately noref-names. Recordingref-nameswould tie an archive's content, and so its checksum, to whichever branches happen to point at the commit, so moving a branch afterwards would silently change an already-published download. That instability is why this was declined in 2023; the stable template did not exist yet. Describe output depends only on the commit and the tags reachable from it, so a branch moving cannot change it. Adding or moving a tag in the commit's ancestry still can.A
MANIFEST.inkeeps the file out of the sdist. It only carries a version oncegit archivehas expanded it, and an sdist states its version in its metadata anyway; shipping the bare template would leave a stray$Format:...$forsetuptools-scmto consider on every build from an unpacked sdist. Verified that the exclusion drops exactly that one file and nothing else.While here: off the deprecated
write_toontoversion_file, andwrite_to_source = truestated explicitly —setuptools-scmis about to flip that default, andsrc/_pytest/_version.pyshould keep being written into checkouts. That option is what sets the newsetuptools-scm>=10.1floor; it can go back to>=8if the floor is unwelcome, at the cost of a deprecation warning now and a silent behaviour change later.Releases are unaffected —
deploy.ymlsuppliesSETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST.Verified
git archiveexpansiondescribe-namematchesgit describeexactly.git)MANIFEST.in.git_archival.txtalonesetuptools-scmwarningspre-commit run -a🤖 Generated with Claude Code