Coverage for src/rhiza_task/__init__.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-10-13 02:27 +0000

1"""The rhiza developer tasks, as a pinned CLI instead of a synced make layer. 

2 

3What this replaces, per consumer repository: ``.rhiza/rhiza.mk`` (200 lines) and the ten 

4fragments in ``.rhiza/make.d/`` (823 lines), synced at a template tag and excluded, 

5shadowed or patched wherever a project disagreed with them. Here they are a dependency 

6pin -- ``uvx rhiza-task@1.6.0 test`` -- so there is nothing to copy, nothing to exclude in 

7``template.yml``, and nothing to drift. 

8 

9Sibling to ``pytest-rhiza``, which did the same for ``.rhiza/tests``. 

10 

11Layout: 

12 

13* :mod:`rhiza_task.spec` -- the task model: ``Task``, ``Guard``, ``Skip``/``Failed``, and 

14 the registry that replaces make's double-colon rules. 

15* :mod:`rhiza_task.config` -- six-layer settings resolution, replacing ``?=`` and ``+=``. 

16* :mod:`rhiza_task.uv` -- the ways rhiza reaches a tool. 

17* :mod:`rhiza_task.runner` -- prerequisite dedup, guard evaluation, outcome bookkeeping. 

18* :mod:`rhiza_task.cli` -- the Typer app, generated from the registry. 

19* :mod:`rhiza_task.tasks` -- the task modules themselves, loaded by entry point. 

20""" 

21 

22from importlib.metadata import PackageNotFoundError 

23from importlib.metadata import version as _installed_version 

24 

25__all__ = ["__version__"] 

26 

27# Read from the installed distribution's metadata rather than written here. hatch-vcs 

28# derives the version from the git tag at build time, so this file has no number to keep 

29# in step and bump-my-version has no [[files]] entry for it -- which is the point: a 

30# version written in two places is a version that can disagree with itself, and the release 

31# that shipped 1.0.0 with a stale uv.lock is what that looks like. 

32# 

33# The fallback is for a source tree that was never installed -- someone running out of a 

34# clone with `python -c "import rhiza_task"` and no `uv sync`. Every real invocation is 

35# `uvx rhiza-task@X.Y.Z`, which installs the distribution, so metadata is present. A 

36# literal here would be a second source of truth for exactly the case that does not 

37# matter, so it says what it knows instead. 

38try: 

39 __version__ = _installed_version("rhiza-task") 

40except PackageNotFoundError: # pragma: no cover - requires an uninstalled source tree 

41 __version__ = "0+unknown"