Commit 118d5e3
fix: derive __version__ from package metadata (#2)
The publish workflow's `uv version --bump` step only edits
`pyproject.toml`, but `__version__` was a hand-kept constant in
`__init__.py`. After the v0.2.0 release the wheel's metadata said
`0.2.0` while `commonlid.__version__` and every `summary.json`'s
`commonlid_version` field stayed at `0.1.0`.
Make `pyproject.toml` the single source of truth: read the version
from `importlib.metadata.version("commonlid")` at import time, with a
sentinel fallback for un-installed source-tree imports. Lives in a new
`_version.py` to keep `__init__.py` lint-clean (RUF067 forbids
runtime statements there).
Add a regression test asserting `commonlid.__version__` equals
`importlib.metadata.version("commonlid")` so any future drift is
caught by the standard gate run instead of in production.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a8656dd commit 118d5e3
3 files changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
19 | 30 | | |
20 | 31 | | |
21 | 32 | | |
| |||
0 commit comments