🔧 Single-source the package version #42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/single-source-version"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What it does
Single-sources the package version so a bump is a one-line edit.
comwatt_client/__init__.pynow defines__version__ = "0.3.2"(source of truth) and exports it in__all__.pyproject.tomlusesdynamic = ["version"]+[tool.setuptools.dynamic] version = { attr = "comwatt_client.__version__" }— the build reads the version statically from the module, norequestsimport needed at build time.tests/test_version.py: asserts__version__is a non-empty string, is exported, and equalsimportlib.metadata.version("comwatt-client")(proves theattrwiring end-to-end).Verification
pip install -e .→importlib.metadata.version("comwatt-client")resolves to0.3.2via the attr.python -m build→ producescomwatt_client-0.3.2.{tar.gz,whl}.pytest→ 92 passed (3 new), no regressions.mypy→ clean.Merge safety
Ships alone; the built/installed version stays
0.3.2(now derived from the attr). No behaviour change, no prod risk.Draft (WIP) — remove the
WIP:prefix to mark ready for review.Move the version string to a single source of truth in comwatt_client/__init__.py and derive the packaging metadata from it: - __init__.py exposes __version__ = "0.3.2" (and exports it in __all__) - pyproject.toml uses dynamic = ["version"] with [tool.setuptools.dynamic] version = { attr = "comwatt_client.__version__" } - add tests/test_version.py asserting __version__ is a non-empty string, is exported, and matches importlib.metadata.version("comwatt-client") Bumping the version is now a one-line edit in __init__.py.WIP: 🔧 Single-source the package versionto 🔧 Single-source the package version