diff --git a/python/Cargo.toml b/python/Cargo.toml index 56645016..d42a6062 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,11 +1,16 @@ [package] name = "wifi-densepose-py" version = "2.0.0-alpha.1" -edition.workspace = true -license.workspace = true +# 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 ", "WiFi-DensePose Contributors"] description = "PyO3 bindings for the WiFi-DensePose Rust core — ships as the `wifi-densepose` PyPI wheel (ADR-117)" -repository.workspace = true +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 diff --git a/python/pyproject.toml b/python/pyproject.toml index cc3d08d1..92089b58 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -69,9 +69,11 @@ Documentation = "https://github.com/ruvnet/RuView/tree/main/docs" # wifi-densepose = "wifi_densepose.cli:main" [tool.maturin] -# Layout: ./python/ holds the Rust crate + Python facade; the wheel -# packs `wifi_densepose/` as the top-level package. -python-source = "python" +# Layout: pyproject.toml + Cargo.toml live at `python/`; the +# python-source directory `wifi_densepose/` is a sibling (i.e. at +# `python/wifi_densepose/`). `python-source = "."` tells maturin to +# look for packages directly under the project root. +python-source = "." module-name = "wifi_densepose._native" features = ["pyo3/extension-module"] # Strip debug symbols for smaller release wheels (ADR-117 §5.4 5 MB budget). diff --git a/python/src/lib.rs b/python/src/lib.rs index 046f4864..e05fd167 100644 --- a/python/src/lib.rs +++ b/python/src/lib.rs @@ -48,7 +48,13 @@ fn hello() -> PyResult<&'static str> { /// package (`import wifi_densepose`) and never reach into `_native` /// directly; the leading underscore is a Python convention marking /// it as private. +/// +/// The function name MUST match the `module-name` in pyproject.toml's +/// `[tool.maturin]` block — i.e. it must be `_native` because the +/// pyproject says `module-name = "wifi_densepose._native"`. PyO3 +/// generates the `PyInit__native` symbol from this function name. #[pymodule] +#[pyo3(name = "_native")] fn wifi_densepose_native(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add("__rust_version__", RUST_CORE_VERSION)?; m.add("__rust_build_tag__", RUST_BUILD_TAG)?;