ev-flow / ev-flow/DexTrace

dextrace -V reports stale hardcoded version

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4
Forks
3
Avg merge
3d 4h
Merged PRs (30d)
2

Description

## Summary
The version string is duplicated in two places that can drift apart: `pyproject.toml` (package metadata) and `src/dextrace/version.py` (hardcoded, used by the CLI's `--version`). In the `26.6.1` release these disagree — `pip show dextrace` reports `26.6.1` while `dextrace -V` prints `DexTrace 25.10.1`. A single source of truth avoids this class of bug.

> If you want to read the version of a package, the recommended way is `importlib.metadata.version("name")`.
> — https://docs.python.org/3/library/importlib.metadata.html#distribution-versions

## Root cause
```python
# src/dextrace/version.py
__version__ = "25.10.1"
```
The bump to `26.6.1` was applied to `pyproject.toml` but not to this hardcoded literal, so `dextrace -V` (which reads `__version__`) shipped the old number.

## Fix
```python
# src/dextrace/version.py
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("dextrace")
except PackageNotFoundError: # running from source tree without an install
__version__ = "0.0.0+dev"
```
`pyproject.toml` becomes the only place a version is declared; the CLI always matches the installed package metadata.

## Affected locations
| File | Line(s) | Context |
|------|---------|---------|
| `src/dextrace/version.py` | 5 | Hardcoded `__version__` literal |
| `src/dextrace/cli/main.py` | 8, 26 | Imports `__version__`, uses it for `--version` |

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.