Repository navigation
Single-source the package version (closes #10) - #15
Merged
Merged
Conversation
The version was duplicated in pyproject.toml and src/tracer/__init__.py and had to be bumped together by hand, which already let code, tags and PyPI drift apart once. Make __init__.py the single source of truth via hatchling's dynamic version: - drop the hardcoded [project] version, add dynamic = ["version"] - add [tool.hatch.version] path = "src/tracer/__init__.py" Harden the release workflow with a step that fails the publish if the pushed vX.Y.Z tag does not match __version__, so a mismatched tag can never ship. Verified: pip install -e . and python -m build both succeed, the built wheel metadata reports 0.1.3, and tracer.__version__ matches.
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.
The version was duplicated in
pyproject.tomlandsrc/tracer/__init__.pyand had to be bumped together by hand, which (per the issue) already let the code, tags and PyPI drift apart once.Change
Make
src/tracer/__init__.py's__version__the single source of truth via hatchling's dynamic version, exactly as suggested in the issue:(dropped the hardcoded
[project] version = "..."line).Optional hardening (included)
Added a step to the release workflow that fails the publish if the pushed
vX.Y.Ztag does not match__version__, so a mismatched tag can never ship to PyPI.Acceptance criteria
src/tracer/__init__.py)python -c "import tracer; print(tracer.__version__)"matches the built wheel metadata (both0.1.3)pip install -e .andpython -m buildboth succeedCloses #10.