Derive the version from git instead of a hardcoded 0.1.0 - #1
Merged
Conversation
version was pinned at "0.1.0" in pyproject.toml, so every build reported the same
version regardless of what was in it. microscape-nf installs this with
`pip install git+https://...`, so a pipeline run could not say which code it ran — a
363-sample dataset analysed in July recorded "0.1.0" and nothing else.
setuptools-scm derives it from git describe. Between tags that is
0.1.1.dev<n>+g<commit>, so the version string carries the commit itself. Tag releases
deliberately; everything in between increments on its own.
version_file generates _version.py at build time, gitignored, so __version__
is real at runtime rather than reconstructed
fallback_version pip sometimes clones without tags — fail soft, do not break install
__init__ reads _version.py, falls back to importlib.metadata for editable
installs, then to 0.0.0+unknown
Verified: wheel builds to 0.1.1.dev9+g1bbad5a19, and that commit
matches what the container's direct_url.json independently recorded.
This was referenced Jul 31, 2026
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.
Why
version = "0.1.0"is hardcoded inpyproject.tomland has never moved, so every buildof this package reports the same version regardless of what is in it.
That matters because microscape-nf installs this with
pip install git+https://…. A363-sample dataset analysed on 2026-07-23 could not say which code produced it: the run
manifest recorded
0.1.0and nothing else, and the container that ran it had since beenrebuilt. Three versions of the pipeline were in play with no way to tell them apart.
What this does
setuptools-scmderives the version fromgit describe. Between tags that yields0.1.1.dev<n>+g<commit>— the version string carries the commit itself, so it identifiesthe source even with no other metadata.
v0.1.00.1.00.1.1.dev<n>+g<commit>Tag releases deliberately (
git tag -a v0.2.0 -m …); everything between tags incrementson its own.
Three details worth noting:
version_filegenerates_version.pyat build time (gitignored) so__version__is real at runtime rather than reconstructed by the caller.
fallback_versionbecause pip sometimes clones without tags — that should degradeto
0.0.0+unknown, not break the install.__init__.pyreads_version.py, falls back toimportlib.metadatafor editablecheckouts, then to
0.0.0+unknown.Verified
Wheel builds cleanly and
_version.pyships inside it. The derived commit matches whatthe running container's
direct_url.jsonindependently recorded — so the version stringand the install metadata now agree on the same commit, from two different mechanisms.
Companion change in microscape-nf (
run-manifestbranch) records both, plus the actualversion of every tool the pipeline runs.