Read the package version from installed metadata - #200
vahid-ahmadi wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
fb343df to
4cece8e
Compare
|
Reviewed with a fresh pass. The bug is real — To do
Optional
Not this PR's faultThe |
__init__.py carried a hardcoded 1.1.2 while pyproject.toml was at 3.1.1, two major versions apart, because the version bump script only updates pyproject.toml. Reading from importlib.metadata means there is one source of truth and the two cannot drift again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fallback was 'unknown', which packaging.version.parse rejects, so a consumer comparing versions would raise InvalidVersion in exactly the uninstalled-source-tree case the fallback exists for. Now 0.0.0+unknown. Adds the tests the PR was missing: that __version__ matches the installed distribution, that both it and the fallback parse, and that the fallback branch is reached when the distribution is absent. Drops the '# Python 3.8+' comment, which named versions this package does not support (requires-python is >=3.12,<3.15).
|
Rebased onto current Also addressed the review points:
|
b646ce7 to
2edf0f6
Compare
microimpute/__init__.pyhardcoded__version__ = "1.1.2"whilepyproject.tomldeclared3.1.1— two major versions apart, because.github/bump_version.pyonly rewritespyproject.toml.Reading from
importlib.metadatagives one source of truth, so the two cannot drift again:Falls back to
"unknown"when running from a source tree with no install.Worth fixing ahead of the JOSS submission in the paper PR: a reviewer checks that the archived release version matches the software, and
microimpute.__version__was reporting the wrong one.