Files
ruvnet--RuView/python/Cargo.toml
T
ruv 4ec5b166e6 fix(adr-117/p1): standalone Cargo.toml + python-source=. + #[pyo3(name=_native)] (P1 GREEN)
Three fixes to make maturin develop actually work locally:

1. `python/Cargo.toml` removed `*.workspace = true` inheritance —
   the python/ crate is intentionally outside the v2/ workspace
   (ADR-117 §5.2) so it needs every `[package]` field local.

2. `python/pyproject.toml` `python-source = "python"` was wrong
   because pyproject.toml lives at python/ — maturin was looking for
   python/python/. Changed to `python-source = "."` so the
   `wifi_densepose/` package directory sibling-to-pyproject is found.

3. `python/src/lib.rs` `#[pymodule] fn wifi_densepose_native` →
   `#[pymodule] #[pyo3(name = "_native")] fn wifi_densepose_native`.
   PyO3 generates `PyInit__native` from the pyo3-name attribute, which
   must match the `module-name` in pyproject.toml's [tool.maturin]
   block ("wifi_densepose._native"). Without this attribute the wheel
   builds but `import wifi_densepose._native` fails with
   ModuleNotFoundError.

## Local validation (P1 acceptance gate)

```
$ python -m venv .venv && .venv/Scripts/python -m pip install maturin pytest
$ VIRTUAL_ENV=… maturin develop --release
…
    Finished `release` profile [optimized] target(s)
📦 Built wheel for abi3 Python ≥ 3.10
🛠 Installed wifi-densepose-2.0.0a1

$ .venv/Scripts/python -c 'import wifi_densepose; print(wifi_densepose.__version__, wifi_densepose.__rust_version__, wifi_densepose.hello())'
2.0.0a1 2.0.0-alpha.1 ok

$ .venv/Scripts/python -m pytest tests/ -v
tests/test_smoke.py::test_package_imports PASSED
tests/test_smoke.py::test_version_string_well_formed PASSED
tests/test_smoke.py::test_rust_version_surfaced PASSED
tests/test_smoke.py::test_build_features_listed PASSED
tests/test_smoke.py::test_hello_returns_ok PASSED
tests/test_smoke.py::test_native_module_private PASSED
======================== 6 passed in 0.05s =========================
```

P1 closed. Moving to P2 (core type bindings).

Refs #785, ADR-117 §6.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-24 10:48:28 -04:00

41 lines
1.9 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[package]
name = "wifi-densepose-py"
version = "2.0.0-alpha.1"
# The `python/` crate is intentionally OUTSIDE the `v2/` Cargo
# workspace (ADR-117 §5.2) so maturin's `python-source` + `module-name`
# config stays self-contained and `cargo test --workspace` in v2/
# doesn't have to compile pyo3. Hence no `*.workspace = true`
# inheritance here — every field is local.
edition = "2021"
license = "MIT"
authors = ["rUv <ruv@ruv.net>", "WiFi-DensePose Contributors"]
description = "PyO3 bindings for the WiFi-DensePose Rust core — ships as the `wifi-densepose` PyPI wheel (ADR-117)"
repository = "https://github.com/ruvnet/RuView"
# ADR-117 §5.2: the Python wheel's compiled module name is
# `wifi_densepose._native` (the leading underscore marks it as an internal
# implementation detail re-exported by the pure-Python facade in
# `wifi_densepose/__init__.py`). Keeping the name distinct from the crate
# avoids the maturin gotcha where `wifi_densepose-py` would collide with
# the user-facing `wifi_densepose` package on import.
[lib]
name = "wifi_densepose_native"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[dependencies]
# PyO3 with abi3-py310 — one compiled binary covers Python 3.10, 3.11,
# 3.12, 3.13, and any future 3.x that keeps the stable ABI (ADR-117 §5.4).
# Without abi3 we'd need a separate wheel per Python minor version × OS
# × arch, blowing up the cibuildwheel matrix.
pyo3 = { version = "0.22", features = ["extension-module", "abi3-py310"] }
# Re-export the Rust core types through PyO3 #[pyclass] wrappers in P2.
# Default-features-off keeps the wheel size below the 5 MB ADR-117 §5.4
# budget by avoiding optional BLAS/openssl chains.
wifi-densepose-core = { version = "0.3.0", path = "../v2/crates/wifi-densepose-core" }
[dev-dependencies]
# Doc-test infrastructure for the Python-facing examples in the bound
# Rust functions. Lands properly in P2 once #[pyfunction]s exist to test.