Skip to content

fix(version): derive __version__ from package metadata, guard the drift - #6

Merged
joepetjr merged 1 commit into
mainfrom
fix/version-single-source
Aug 4, 2026
Merged

joepetjr merged 1 commit into
mainfrom
fix/version-single-source

Conversation

@joepetjr

@joepetjr joepetjr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

0.1.1 bumped version in pyproject.toml and left __version__ in
claude_batch_runner/__init__.py at 0.1.0, so the package attribute reported the previous release
for 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__ now
derives from installed metadata, leaving pyproject.toml as the single source of truth — which is
already what release.yml cross-checks against the git tag. A source checkout that was never
pip-installed reports 0.0.0.dev0 rather than a fictional release number.

Test plan

tests/test_version.py asserts __version__ equals the pyproject.toml literal, plus a guard that
the suite is not silently exercising the uninstalled fallback.

  • Full suite: 75 passed
  • ruff check . → all checks passed; ruff format --check → clean
  • python -c "import claude_batch_runner; print(claude_batch_runner.__version__)" → 0.1.1
  • Proven able to fail: temporarily setting the pyproject version to 0.9.9 turns
    test_version_matches_pyproject red (1 failed, 1 passed); reverting returns it to 2 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.

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.
@joepetjr
joepetjr merged commit 4e04cfa into main Aug 4, 2026
3 checks passed
@joepetjr
joepetjr deleted the fix/version-single-source branch August 4, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant