Python binding (pyo3 / maturin)
A thin pyo3 wrapper over the single nirs4all-io Rust core (the facade crate) —
all RESOLVE → INFER → CONFIGURE → MATERIALIZE logic lives in Rust; Python only
adapts the results.
Layout (mixed maturin)
- Native extension
nirs4all_io._native(the pyo3 module, built fromsrc/lib.rs). - Python package
nirs4all_io(underpython/) that wraps_nativeand adds the lazySpectroDatasetadapter (_adapter.py).
numpy and pandas are wheel runtime dependencies — they back the full-array
SpectroDataset reconstruction and are not nirs4all.
Build & install
maturin develop # build + install into the active venv (dev)
maturin build # build an abi3 wheel (abi3-py311)
pip install <wheel> # install the built wheel
Requires Python ≥ 3.11. See PACKAGING.md for the abi3 wheel / nirs4all-formats
reuse details.
API
All functions are re-exported from nirs4all_io.
| Function | Signature | Returns |
|---|---|---|
infer |
infer(input, conventions=None) |
a DatasetPlan (data input only) |
to_spec |
to_spec(input, conventions=None, name=None) |
a DatasetSpec |
validate |
validate(spec) |
None; raises ValueError if invalid |
load |
load(input, *, target="assembled", conventions=None, name=None, base_dir=None, spectro_dataset_cls=None) |
summary dict, DatasetPackage, or a SpectroDataset |
to_dataset_package |
to_dataset_package(input, *, conventions=None, base_dir=None, name=None) |
a target-agnostic DatasetPackage |
describe_dataset_package |
describe_dataset_package(input, *, conventions=None, base_dir=None, name=None, canonical=False) |
package summary dict or canonical JSON |
to_spectrodataset |
to_spectrodataset(full, *, spectro_dataset_cls=None) |
a SpectroDataset |
Inputs (input) accept a str path, a pathlib.Path, a sequence of either
(file list), or a dict (a spec). validate additionally accepts a JSON string.
Typed results. infer returns a DatasetPlan and to_spec a DatasetSpec.
Both subclass dict — they stay subscriptable, JSON-serializable, and valid
inputs to validate / load — and add a readable repr plus convenience
accessors:
DatasetSpec:.name,.schema_version,.sources.DatasetPlan:.overall_score,.resolved_spec(aDatasetSpec),.recommendations,.warnings, and.decisions()(the scored structure/signal_type/task_type decisions, keyed by kind).
>>> plan = nio.infer("/data/run")
>>> plan
DatasetPlan(overall_score=0.883, structure='x_y_separate'(0.85), ...)
>>> plan.decisions().keys()
dict_keys(['structure', 'signal_type', 'task_type'])
>>> plan.resolved_spec
DatasetSpec(name='data', schema_version=1, sources=[data:mixed])
load targets:
target="assembled"→ the rounded structural summary dict (nonirs4all).target="dataset_package"/target="package"→ a target-agnosticDatasetPackagewith payload manifest hashes and an assembled view.target="spectrodataset"→ a real nirs4allSpectroDataset, built via a lazynirs4allimport inside the adapter. This is the onlynirs4alltouch-point;import nirs4all_ionever importsnirs4all(enforced bytests/test_import_boundary.py). Injectspectro_dataset_cls=to drive the builder with a double (testing without nirs4all).
Usage
from pathlib import Path
import nirs4all_io as nio
plan = nio.infer(Path("/data/run")) # DatasetPlan (typed dict)
spec = nio.to_spec("/data/run") # DatasetSpec (typed dict)
nio.validate(spec) # raises ValueError if invalid
print(spec.schema_version, len(spec.sources)) # convenience accessors
print(plan.decisions()) # scored inference decisions
summary = nio.load("/data/run") # target="assembled" (default)
package = nio.to_dataset_package("/data/run") # target-agnostic package
ds = nio.load("/data/run", target="spectrodataset") # nirs4all SpectroDataset
Test
pytest bindings/python/tests
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nirs4all_io-0.1.14.tar.gz.
File metadata
- Download URL: nirs4all_io-0.1.14.tar.gz
- Upload date:
- Size: 364.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
960ad7946d446f8dd011a2ffcb493c479092b638f13b08241debb23e33653ae8
|
|
| MD5 |
51c1b117e1bb619d64b9710036332215
|
|
| BLAKE2b-256 |
7f8fdcdc7298a490496d41493c9fe2a5919a003d06a904aa50a41bbe93286d16
|
Provenance
The following attestation bundles were made for nirs4all_io-0.1.14.tar.gz:
Publisher:
release.yml on GBeurier/nirs4all-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirs4all_io-0.1.14.tar.gz -
Subject digest:
960ad7946d446f8dd011a2ffcb493c479092b638f13b08241debb23e33653ae8 - Sigstore transparency entry: 2699646049
- Sigstore integration time:
-
Permalink:
GBeurier/nirs4all-io@df7f2198862c71a24aeeba08ba09ee118524b55d -
Branch / Tag:
refs/tags/v0.1.14 - Owner: https://github.com/GBeurier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df7f2198862c71a24aeeba08ba09ee118524b55d -
Trigger Event:
push
-
Statement type:
File details
Details for the file nirs4all_io-0.1.14-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: nirs4all_io-0.1.14-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f7ed1366b7bac4c26ca1e49b67d06ea52554aa5b6b99387010106ceef78009
|
|
| MD5 |
9f60304cb066b915c77039232dfedbee
|
|
| BLAKE2b-256 |
8eaf4dcf404d7cfe62925b80c3c245db5f0317369e2b319c1086b9e529b9bcda
|
Provenance
The following attestation bundles were made for nirs4all_io-0.1.14-cp311-abi3-win_amd64.whl:
Publisher:
release.yml on GBeurier/nirs4all-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirs4all_io-0.1.14-cp311-abi3-win_amd64.whl -
Subject digest:
63f7ed1366b7bac4c26ca1e49b67d06ea52554aa5b6b99387010106ceef78009 - Sigstore transparency entry: 2699646094
- Sigstore integration time:
-
Permalink:
GBeurier/nirs4all-io@df7f2198862c71a24aeeba08ba09ee118524b55d -
Branch / Tag:
refs/tags/v0.1.14 - Owner: https://github.com/GBeurier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df7f2198862c71a24aeeba08ba09ee118524b55d -
Trigger Event:
push
-
Statement type:
File details
Details for the file nirs4all_io-0.1.14-cp311-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: nirs4all_io-0.1.14-cp311-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.11+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24298b9e53b67e1a2bde7639871bf0de8fa7f2eb95e4f3b68afececc895454e1
|
|
| MD5 |
839ef8ba6c9a15d53e21e88cfb1b3e21
|
|
| BLAKE2b-256 |
9a0f5c7459cac81903f04b1d9cb36cbfc8c867565cd9aeddba1b550d68eb7d69
|
Provenance
The following attestation bundles were made for nirs4all_io-0.1.14-cp311-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on GBeurier/nirs4all-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirs4all_io-0.1.14-cp311-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
24298b9e53b67e1a2bde7639871bf0de8fa7f2eb95e4f3b68afececc895454e1 - Sigstore transparency entry: 2699646202
- Sigstore integration time:
-
Permalink:
GBeurier/nirs4all-io@df7f2198862c71a24aeeba08ba09ee118524b55d -
Branch / Tag:
refs/tags/v0.1.14 - Owner: https://github.com/GBeurier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df7f2198862c71a24aeeba08ba09ee118524b55d -
Trigger Event:
push
-
Statement type:
File details
Details for the file nirs4all_io-0.1.14-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: nirs4all_io-0.1.14-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c59eb8d8ecf40269b76064eddb4d8aee8ce9661649ebc356fb6ded707fe45f52
|
|
| MD5 |
03b5296afc382eb80958bb09df8bfb4e
|
|
| BLAKE2b-256 |
80b7f42646ff93180f8c97a689fcf6d450bdf84de8ccd46ddf97e1ee02ec57b0
|
Provenance
The following attestation bundles were made for nirs4all_io-0.1.14-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on GBeurier/nirs4all-io
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nirs4all_io-0.1.14-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
c59eb8d8ecf40269b76064eddb4d8aee8ce9661649ebc356fb6ded707fe45f52 - Sigstore transparency entry: 2699646147
- Sigstore integration time:
-
Permalink:
GBeurier/nirs4all-io@df7f2198862c71a24aeeba08ba09ee118524b55d -
Branch / Tag:
refs/tags/v0.1.14 - Owner: https://github.com/GBeurier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@df7f2198862c71a24aeeba08ba09ee118524b55d -
Trigger Event:
push
-
Statement type: