Repository navigation
fix(version): derive __version__ from package metadata, guard the drift - #6
Merged
Merged
Conversation
The 0.1.1 release bumped the literal in pyproject.toml and left the second one in claude_batch_runner/__init__.py at 0.1.0, so the package attribute reported the previous release for the whole of 0.1.1. Rather than bump the second literal and re-arm the same trap, remove it: __version__ now derives from installed metadata, leaving pyproject.toml as the single source of truth -- which is what release.yml already cross-checks against the git tag. tests/test_version.py fails if the two disagree, which also catches a stale editable install. A never-installed source checkout reports 0.0.0.dev0 rather than a fictional release number.
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
0.1.1bumpedversioninpyproject.tomland left__version__inclaude_batch_runner/__init__.pyat0.1.0, so the package attribute reported the previous releasefor the whole of that version. Found while adopting the build downstream.
Rather than bump the second literal and re-arm the same trap, this removes it.
__version__nowderives from installed metadata, leaving
pyproject.tomlas the single source of truth — which isalready what
release.ymlcross-checks against the git tag. A source checkout that was neverpip-installed reports
0.0.0.dev0rather than a fictional release number.Test plan
tests/test_version.pyasserts__version__equals thepyproject.tomlliteral, plus a guard thatthe suite is not silently exercising the uninstalled fallback.
ruff check .→ all checks passed;ruff format --check→ cleanpython -c "import claude_batch_runner; print(claude_batch_runner.__version__)"→0.1.10.9.9turnstest_version_matches_pyprojectred (1 failed, 1 passed); reverting returns it to2 passed.With the derivation in place the only way the two can disagree is a stale editable install — which
is itself worth failing on, since every other check in the repo trusts pyproject.
CHANGELOG entry added under Unreleased.