Commit d25ca35
feat(python+docs): add sparrow_engine.__version__ + fix README install lines for uv venv
Two doc/API gaps surfaced during a 2026-05-26 prod-PyPI manual smoke
attempt in a fresh uv venv:
1. README pip install lines fail under `uv venv`. `uv venv` does not
install pip in the venv, so `source activate && pip install ...`
falls back to the system pip — which usually targets the wrong
Python version and errors with "No matching distribution found"
for the cp311-abi3 wheel. Show both `uv pip install` (uv venv) and
`pip install` (stdlib venv) install flows; spell out the cp311
abi3 floor.
2. `sparrow_engine.__version__` missing. The conventional Python
handle for "which version did I install" raised AttributeError;
the only knob was `importlib.metadata.version('sparrow-engine-gpu')`
which required the tester to know the distribution name. Single-
source the version from wheel METADATA via
`importlib.metadata.version(...)`; resolve the GPU dist name first,
fall through to the CPU name, then `"unknown"` on broken install.
Changes:
- README.md §Python package only (PyPI): split into "With uv" and
"With stdlib venv" subsections; add cp311 abi3 floor note + explain
why bare `pip install` after `uv venv` fails; add the
__version__ smoke command as the post-install sanity check.
- sparrow-engine-python/python/sparrow_engine/__init__.py: add
_resolve_version() at the top, set module-level __version__, append
to __all__.
- sparrow-engine-python/tests/test_version_attr.py: 3 new tests
asserting the attribute exists, is in __all__, and matches PEP-440
(or the "unknown" fallback). All 3 pass; full suite 17 pass 8 skip.
- docs/user-manual.md §6.1: document __version__ as a public attribute
next to the 15-function table; cite the resolver at __init__.py:16-29.
Verified end-to-end on the dev box: built sparrow_engine-0.1.4 wheel
locally, installed into a fresh `uv venv --python 3.11`, ran
`python -c "import sparrow_engine; print(sparrow_engine.__version__)"`
→ `0.1.4`, and confirmed `'__version__' in sparrow_engine.__all__`.
This change does NOT bump pyproject.toml from 0.1.4 to 0.1.5. The fixes
land in source for the next release; the prod-PyPI 0.1.4 wheel still
lacks __version__ until a 0.1.5 publish.
Origin: user `/session-init sparrow-engine` 2026-05-26 PT, prod-PyPI
smoke attempt in a fresh uv venv surfaced both gaps.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent d471b17 commit d25ca35
4 files changed
Lines changed: 105 additions & 3 deletions
File tree
- docs
- sparrow-engine/sparrow-engine-python
- python/sparrow_engine
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
35 | 60 | | |
36 | 61 | | |
37 | 62 | | |
| |||
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
43 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
44 | 71 | | |
45 | 72 | | |
46 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
10 | 30 | | |
11 | 31 | | |
12 | 32 | | |
| |||
210 | 230 | | |
211 | 231 | | |
212 | 232 | | |
| 233 | + | |
| 234 | + | |
213 | 235 | | |
214 | 236 | | |
215 | 237 | | |
| |||
Lines changed: 51 additions & 0 deletions
| 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 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments