fix(python): flatten packing buffers and package Cargo libraries
This commit is contained in:
parent
f081a808ea
commit
912a267028
1 changed files with 355 additions and 9 deletions
45
README.md
45
README.md
|
|
@ -58,6 +58,51 @@ range values must be aligned. Exported Arrow data owns its storage independently
|
|||
of the input. See [Arrow Schema Documentation](ARROW_SCHEMA.md) for the scan
|
||||
schema, offset definitions, and ID assignment.
|
||||
|
||||
## Python package and validation
|
||||
|
||||
The Python packing helpers require NumPy and CFFI, both declared as runtime
|
||||
dependencies. Setuptools invokes `cargo build --release --lib` and bundles the
|
||||
C ABI shared library in a platform-specific wheel. Its version comes from
|
||||
`Cargo.toml`. The C declarations are in `klamath_rs_ext/_ffi.h`; the loader uses
|
||||
CFFI ABI mode, so no Python extension compilation or Maturin is required.
|
||||
|
||||
```sh
|
||||
python3 -m pip install .
|
||||
```
|
||||
|
||||
To build a source archive and a wheel with the `build` frontend and installed
|
||||
Setuptools/Wheel tooling:
|
||||
|
||||
```sh
|
||||
python3 -m build --no-isolation
|
||||
```
|
||||
|
||||
Source archives include a Cargo lockfile, and wheel builds use `--locked` so
|
||||
building from an archive retains the resolved Rust dependency versions. Wheels
|
||||
are tagged for the build platform and use the Python-independent `py3-none` ABI.
|
||||
The CLI continues to build directly with Cargo and has no Python dependency.
|
||||
|
||||
For source-tree development, point the CFFI loader at a Cargo-built library:
|
||||
|
||||
```sh
|
||||
cargo build --release --lib
|
||||
KLAMATH_RS_LIBRARY="$PWD/target/release/libklamath_rs_ext.so" \
|
||||
python3 -m unittest discover -s tests/python -v
|
||||
```
|
||||
|
||||
Use `libklamath_rs_ext.dylib` on macOS or `klamath_rs_ext.dll` on Windows. Without
|
||||
the explicit override, the loader uses the library bundled inside the package.
|
||||
After installing a wheel, run its tests outside the source checkout to exercise
|
||||
the installed package:
|
||||
|
||||
```sh
|
||||
python3 -I -m unittest discover -s /absolute/path/to/klamath-rs/tests/python -v
|
||||
```
|
||||
|
||||
The Python tests cover multidimensional and noncontiguous packing, input
|
||||
preservation, range errors, and the C declarations for Arrow exports and release
|
||||
callbacks. Run `cargo test` and `cargo test --release` for native validation.
|
||||
|
||||
## Layout review CLI
|
||||
|
||||
The review CLI is a standalone Rust executable:
|
||||
|
|
|
|||
Loading…
Reference in a new issue