diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48a8681..78c902f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,11 +28,19 @@ jobs: run: uv run pytest -q # A passing suite and a working installed entrypoint are not the same - # thing, and that gap is where a broken `bin` hides. - - name: Installed entrypoint + # thing, and that gap is where a broken `bin` hides. It is not enough to + # run --version: 0.5.1 shipped an entrypoint that ran and reported the + # wrong number, so assert the reported version is the packaged one. + - name: Installed entrypoint reports the packaged version run: | uv tool install --editable . - samplerdisc --version + got="$(samplerdisc --version)" + want="$(uv version --short)" + if [ "$got" != "$want" ]; then + echo "::error::samplerdisc --version says '$got', packaged version is '$want'" + exit 1 + fi + echo "entrypoint reports $got" # ADR-0008: no disc images or audio, ever. Enforced, not remembered. - name: No media in tracked files diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e234d5..d626c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Notable changes to `samplerdisc`. Format-level findings live in [docs/formats/](docs/formats/); decisions and their rejected alternatives live in [docs/adr/](docs/adr/). This file records what changed for someone using the tool. +## 0.5.2 — 2026-09-05 + +### Fixed + +- **`samplerdisc --version` reports the real version again.** The 0.5.1 release shipped an entrypoint that printed `0.5.0`: the version lived in two places — `pyproject.toml` and a hardcoded `__version__` literal — and bumping the package moved only the first. `__version__` is now read once from the installed distribution's metadata, so there is a single source of truth that cannot drift. The install-time CI check now asserts the entrypoint's reported version equals the packaged version rather than only that it runs, and the unit test asserts the same invariant instead of pinning a literal. If you installed 0.5.1, upgrade — the package was otherwise identical, only its self-reported version was wrong. ([src/samplerdisc/__init__.py](src/samplerdisc/__init__.py)) + ## 0.5.1 — 2026-09-05 ### Added diff --git a/pyproject.toml b/pyproject.toml index d86600b..21cc175 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "samplerdisc" -version = "0.5.1" +version = "0.5.2" description = "Convert vintage sampler CD-ROM images (AKAI, E-mu, Roland) to uncompressed WAV" readme = "README.md" license = "MIT" diff --git a/src/samplerdisc/__init__.py b/src/samplerdisc/__init__.py index 8be9eda..277bfa5 100644 --- a/src/samplerdisc/__init__.py +++ b/src/samplerdisc/__init__.py @@ -1,3 +1,11 @@ """Convert vintage sampler CD-ROM images to uncompressed WAV.""" -__version__ = "0.5.0" +from importlib.metadata import PackageNotFoundError, version + +# One source of truth: the packaged version in pyproject.toml, read back from +# the installed distribution's metadata. A hardcoded literal here drifts the +# moment the package version bumps — 0.5.1 shipped reporting 0.5.0 that way. +try: + __version__ = version("samplerdisc") +except PackageNotFoundError: # a source tree with no installed distribution + __version__ = "0.0.0+unknown" diff --git a/tests/test_cli.py b/tests/test_cli.py index 1ff2b2a..0131d46 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,7 +3,15 @@ def test_version_matches_package(): - assert __version__ == "0.5.0" + """The reported version is the installed metadata, not a hardcoded literal. + + A literal here mirroring a literal in the source is what let 0.5.1 ship + reporting 0.5.0: both sat still while pyproject moved. Assert the real + invariant instead — the runtime string is the packaged version. + """ + from importlib.metadata import version + + assert __version__ == version("samplerdisc") def test_parser_exposes_version_flag(): diff --git a/uv.lock b/uv.lock index 846504c..fb007af 100644 --- a/uv.lock +++ b/uv.lock @@ -90,7 +90,7 @@ wheels = [ [[package]] name = "samplerdisc" -version = "0.5.1" +version = "0.5.2" source = { editable = "." } [package.dev-dependencies]