Skip to content

fix: derive __version__ from package metadata - #14

Open
haeter525 wants to merge 1 commit into
mainfrom
fix/version-single-source
Open

fix: derive __version__ from package metadata#14
haeter525 wants to merge 1 commit into
mainfrom
fix/version-single-source

Conversation

@haeter525

Copy link
Copy Markdown
Member

Closes #13.

Problem

__version__ was a hardcoded literal in src/dextrace/version.py that drifted from pyproject.toml. In 26.6.1, pip show dextrace reported 26.6.1 while dextrace -V printed DexTrace 25.10.1.

Fix

Read the version from importlib.metadata so pyproject.toml is the single source of truth:

from importlib.metadata import version, PackageNotFoundError

try:
    __version__ = version("dextrace")
except PackageNotFoundError:  # running from a source tree without an install
    __version__ = "0.0.0+dev"

Verification

  • pip install -e . then dextrace -VDexTrace 26.6.1 (matches pip show)
  • No new runtime dependency — importlib.metadata is stdlib (Python ≥3.8)

Note

This corrects the CLI version for the next release. PyPI is immutable, so the already-published 26.6.1 keeps reporting 25.10.1; the fix takes effect when a 26.6.2 is cut.

🤖 Generated with Claude Code

Read the version from importlib.metadata so pyproject.toml is the single
source of truth. Previously __version__ was a hardcoded literal that drifted
from pyproject.toml, causing `dextrace -V` to report a stale version.

Fixes #13

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

dextrace -V reports stale hardcoded version

1 participant