chore: make the version single-sourced and enforce consistency - #27
Merged
Merged
Conversation
The version was declared only in pyproject.toml, while tags and releases were created by hand. v0.2.9 shipped with pyproject still declaring 0.2.8, and v0.2.6 declared 0.1.0, so the tag and the package disagreed across several releases. Expose eloquent_notes.__version__ from the installed distribution metadata and add an `eloquent-notes --version` flag, so the runtime reports what is actually installed rather than a second constant to keep in sync. Add tests/test_version.py asserting the pyproject version is valid semver, the package exposes a real installed version, pyproject matches the installed metadata, and the newest v* tag equals v<pyproject version>. The last check fails if a release is tagged before the bump is merged, which is the exact failure mode that produced v0.2.9; it skips when the checkout has no tags so shallow clones still work. Document the release procedure in docs/releasing.md, including the ordering constraint, and reference it from AGENTS.md and the docs nav.
|
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.


Problem
The version is declared only in
pyproject.toml, but tags and releases were created by hand. The two disagreed across several releases:pyproject.tomldeclaredv0.2.9 shipped a package whose metadata said 0.2.8. Nothing caught it.
Changes
Single source of truth.
eloquent_notes.__version__is read from the installed distribution metadata viaimportlib.metadata, so the runtime reports what is actually installed rather than a second constant to maintain. An uninstalled source checkout falls back to0.0.0+unknown, and a test fails if that fallback is ever what runs — so the fallback cannot hide a real problem.eloquent-notes --versionprints it:tests/test_version.pyasserts four invariants:pyproject.tomlversion is validMAJOR.MINOR.PATCHpyproject.tomland the installed metadata agreev*tag equalsv<pyproject version>The last one is the check that would have caught v0.2.9: it fails if a release is tagged before the version bump is merged. It skips when the checkout has no version tags, so shallow clones and source tarballs are unaffected.
I verified it by simulating the v0.2.9 drift locally — setting
pyproject.tomlback to 0.2.8 with the v0.3.0 tag present fails both the metadata and the tag check.docs/releasing.mddocuments the procedure, including the ordering constraint (merge the bump, then tag), and is wired intoAGENTS.mdand the mkdocs nav.Scope
No behavioural change to recording, the pipeline, or note output. v0.3.0 is already released and its tag matches
pyproject.toml, so this lands after it.169 tests pass, mypy and ruff clean,
mkdocs build --strictclean.