mirror of
https://github.com/ruvnet/RuView
synced 2026-06-18 11:43:19 +00:00
5d90d4fef2
ADR-117 P1 — the python/ directory is now a working maturin-buildable
crate that produces the v2.x replacement for the legacy pure-Python
wifi-densepose==1.1.0 PyPI wheel.
## What lands
- `python/Cargo.toml` — PyO3 0.22 with `extension-module` + `abi3-py310`
(one binary covers Python 3.10–3.13 per OS/arch — keeps the
cibuildwheel matrix to 5 wheels per release, not 20). Depends on
`wifi-densepose-core` from the existing v2/ workspace via relative
path.
- `python/pyproject.toml` — maturin>=1.7 build backend with
`python-source = "python"` and `module-name = "wifi_densepose._native"`
so the compiled module loads as an internal underscore-private
submodule of the user-facing `wifi_densepose` package. PEP 621
metadata + classifiers + project URLs. Optional-deps:
`wifi-densepose[client]` for the P4 WS/MQTT pure-Python layer,
`wifi-densepose[dev]` for the test toolchain (pytest, ruff, mypy).
- `python/src/lib.rs` — minimal `#[pymodule] wifi_densepose_native`
exporting `__rust_version__`, `__rust_build_tag__`,
`__build_features__`, and a `hello()` smoke function. P2 will land
the core type bindings here.
- `python/wifi_densepose/__init__.py` — pure-Python facade re-exporting
the compiled module's symbols under their stable user-facing names.
Docstring teaches the v1→v2 migration story up-front.
- `python/wifi_densepose/py.typed` — PEP 561 marker so `mypy --strict`
in user code treats the wheel as fully typed (real stubs land in P2).
- `python/tests/test_smoke.py` — 6 P1 acceptance tests:
1. package imports without error
2. version string is PEP 440-compliant
3. `__rust_version__` is reachable from Python (the diagnostic
surface ADR-117 §5.2 promised)
4. `__build_features__` lists `p1-scaffold` marker
5. `wifi_densepose.hello()` returns "ok" (FFI round-trip)
6. `wifi_densepose._native` is reachable but the leading underscore
conveys "private; users should import the parent package"
- `python/README.md` — phase ledger, local build instructions
(`maturin develop`), layout diagram.
## What's deferred to P2+
- Core type bindings (`CsiFrame`, `Keypoint`, `PoseEstimate`) — P2
- Vitals + signal DSP bindings + witness v2 — P3
- Pure-Python WS/MQTT client layer (`wifi_densepose[client]`) — P4
- cibuildwheel + PyPI publish — P5
- v1.99.0 tombstone — concurrent with P5
The new `python/` crate is intentionally OUTSIDE the v2/ Cargo
workspace — it has its own Cargo.toml with `[package]` not
`[workspace.package]` inheritance — to keep maturin's `python-source`
+ `module-name` config self-contained and to avoid forcing every
`cargo test --workspace` invocation in v2/ to compile pyo3.
Refs ADR-117 §5 (Detailed design) and §6 (Phased migration).
Refs #785 (tracking issue).
Co-Authored-By: claude-flow <ruv@ruv.net>
67 lines
2.2 KiB
Python
67 lines
2.2 KiB
Python
"""WiFi-DensePose — passive human sensing from WiFi CSI.
|
|
|
|
ADR-117 — v2.0 is a PyO3-bound replacement for the legacy pure-Python
|
|
``wifi-densepose==1.1.0`` (released 2025-06-07). The compiled core is
|
|
the same Rust workspace published in `v2/crates/` of the
|
|
`ruvnet/RuView <https://github.com/ruvnet/RuView>`_ repository.
|
|
|
|
Quick start::
|
|
|
|
import wifi_densepose
|
|
print(wifi_densepose.__version__)
|
|
print(wifi_densepose.__rust_version__)
|
|
print(wifi_densepose.hello()) # → "ok"
|
|
|
|
P1 (this release): scaffold. Core types land in P2; vital signs +
|
|
signal DSP in P3; WebSocket/MQTT client in P4. See the
|
|
`ADR-117 modernization plan
|
|
<https://github.com/ruvnet/RuView/blob/main/docs/adr/ADR-117-pip-wifi-densepose-modernization.md>`_
|
|
for the full phase ledger.
|
|
|
|
Migrating from v1.x: the v1 line was pure-Python and had a different
|
|
API surface. v2 is a hard break (semver-justified). See the
|
|
``v1.99.0`` tombstone wheel for the migration URL.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
# Public Python version follows the wheel version, NOT the Rust core
|
|
# version. The Rust core version is surfaced separately as
|
|
# `__rust_version__` for diagnostics.
|
|
__version__ = "2.0.0a1"
|
|
|
|
# Re-export the compiled module's surface. The leading underscore on
|
|
# `_native` is intentional — it marks the binding module as internal.
|
|
# Users always import from `wifi_densepose` directly.
|
|
from wifi_densepose import _native
|
|
|
|
__rust_version__: str = _native.__rust_version__
|
|
"""Version of the bound Rust core. Useful for bug reports."""
|
|
|
|
__rust_build_tag__: str = _native.__rust_build_tag__
|
|
"""Build tag of the Rust core (P5 will swap this for the git SHA)."""
|
|
|
|
__build_features__: list[str] = list(_native.__build_features__)
|
|
"""Feature flags the wheel was compiled with."""
|
|
|
|
|
|
def hello() -> str:
|
|
"""Smoke test — confirms the compiled module loads and is callable.
|
|
|
|
Returns:
|
|
Always ``"ok"`` if the wheel built and loaded correctly.
|
|
|
|
Used by ``python/tests/test_smoke.py`` to assert the PyO3 round-trip
|
|
works end-to-end on every cibuildwheel target.
|
|
"""
|
|
return _native.hello()
|
|
|
|
|
|
__all__ = [
|
|
"__version__",
|
|
"__rust_version__",
|
|
"__rust_build_tag__",
|
|
"__build_features__",
|
|
"hello",
|
|
]
|