🔧 Single-source the package version #42

Merged
mat merged 1 commit from chore/single-source-version into main 2026-07-05 09:42:21 +00:00
Owner

What it does

Single-sources the package version so a bump is a one-line edit.

  • comwatt_client/__init__.py now defines __version__ = "0.3.2" (source of truth) and exports it in __all__.
  • pyproject.toml uses dynamic = ["version"] + [tool.setuptools.dynamic] version = { attr = "comwatt_client.__version__" } — the build reads the version statically from the module, no requests import needed at build time.
  • Adds tests/test_version.py: asserts __version__ is a non-empty string, is exported, and equals importlib.metadata.version("comwatt-client") (proves the attr wiring end-to-end).

Verification

  • pip install -e .importlib.metadata.version("comwatt-client") resolves to 0.3.2 via the attr.
  • python -m build → produces comwatt_client-0.3.2.{tar.gz,whl}.
  • pytest92 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.

## What it does Single-sources the package version so a bump is a one-line edit. - `comwatt_client/__init__.py` now defines `__version__ = "0.3.2"` (source of truth) and exports it in `__all__`. - `pyproject.toml` uses `dynamic = ["version"]` + `[tool.setuptools.dynamic] version = { attr = "comwatt_client.__version__" }` — the build reads the version statically from the module, no `requests` import needed at build time. - Adds `tests/test_version.py`: asserts `__version__` is a non-empty string, is exported, and equals `importlib.metadata.version("comwatt-client")` (proves the `attr` wiring end-to-end). ## Verification - `pip install -e .` → `importlib.metadata.version("comwatt-client")` resolves to `0.3.2` via the attr. - `python -m build` → produces `comwatt_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.*
🔧 Single-source the package version via __version__
All checks were successful
Tests / forgejo-pytest (push) Successful in 43s
Tests / forgejo-pytest (pull_request) Successful in 43s
d3115339fe
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.
mat changed title from WIP: 🔧 Single-source the package version to 🔧 Single-source the package version 2026-07-05 09:42:01 +00:00
mat merged commit 3a5b6b2e22 into main 2026-07-05 09:42:21 +00:00
mat deleted branch chore/single-source-version 2026-07-05 09:42:21 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mat/python-comwatt-client!42
No description provided.