Skip to main content

Slim PLS-focused Python binding for the libn4m C ABI from nirs4all-methods.

Project description

pls4all

pls4all is the slim, PLS-only subset of nirs4all-methods — a thin Python binding over the portable libn4m C ABI (a C++17 PLS / NIRS engine). The wheel bundles the libn4m shared library, so pip install pls4all is self-contained; no separate native build is required. For the full method surface (preprocessing, selectors, diagnostics, augmenters, …) install the nirs4all-methods package instead and import it as n4m — both load the same libn4m.

The binding loads libn4m with ctypes.CDLL (so the GIL is released during native calls) and exposes:

  • version() / abi_version() introspection,
  • a Pythonic Context and Config (RAII lifecycle wrappers),
  • the PLS fit/predict surface and a scikit-learn-compatible pls4all.sklearn.PLSRegression (and the other PLS-family estimators),
  • a typed Pls4allError raised on any non-OK status, carrying the context's last_error message.

Quick start

import numpy as np
import pls4all
from pls4all.sklearn import PLSRegression

print(pls4all.version())      # e.g. "1.0.3+abi.2.0.0"
print(pls4all.abi_version())  # (2, 0, 0)

rng = np.random.default_rng(0)
X = rng.standard_normal((40, 12))
y = X @ rng.standard_normal(12)

model = PLSRegression(n_components=5).fit(X, y)
print(model.predict(X).shape)  # (40,)

Low-level lifecycle, if you need it:

with pls4all.Context() as ctx, pls4all.Config() as cfg:
    cfg.algorithm = pls4all.Algorithm.PLS_REGRESSION
    cfg.solver = pls4all.Solver.SIMPLS
    cfg.n_components = 5
    # ... drive a fit through the C ABI ...

scikit-learn is an optional dependency (only pls4all.sklearn needs it); the core import pls4all works with NumPy alone.

Loading libn4m

The bundled wheel ships libn4m inside pls4all/lib/, found automatically. For development against a local build the loader searches, in order:

  1. $PLS4ALL_LIB_PATH — explicit path to libn4m for this package,
  2. $N4M_LIB_PATH — shared libn4m override honoured by both pls4all and n4m,
  3. pls4all/lib/libn4m* next to the installed package (wheel layout),
  4. <repo-root>/build/dev-release/cpp/src/libn4m* (developer convenience),
  5. the standard system search path (LD_LIBRARY_PATH, macOS rpath, Windows PATH).

Building libn4m from source (developers)

cmake --preset dev-release
cmake --build --preset dev-release --parallel

This produces build/dev-release/cpp/src/libn4m.so (.dylib / .dll on macOS / Windows), which the loader rules above pick up.

See https://github.com/GBeurier/nirs4all-methods for the full project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pls4all-1.0.8.tar.gz (131.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pls4all-1.0.8-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

pls4all-1.0.8-py3-none-musllinux_1_2_x86_64.whl (4.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

pls4all-1.0.8-py3-none-musllinux_1_2_aarch64.whl (4.1 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

pls4all-1.0.8-py3-none-manylinux_2_28_x86_64.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

pls4all-1.0.8-py3-none-manylinux_2_28_aarch64.whl (3.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

pls4all-1.0.8-py3-none-macosx_11_0_universal2.whl (7.2 MB view details)

Uploaded Python 3macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file pls4all-1.0.8.tar.gz.

File metadata

  • Download URL: pls4all-1.0.8.tar.gz
  • Upload date:
  • Size: 131.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pls4all-1.0.8.tar.gz
Algorithm Hash digest
SHA256 32325cbb40103d113326bb5e1dde534653bcea3d859ec6a35b90e95ed134cec8
MD5 3daf8ff05d2f1ae54667ebdc1451f91a
BLAKE2b-256 5912ae0b9d7b3aa8502ea0c35f8b87fc1f42dba93a4440e20a8dfaadaeb9cb78

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8.tar.gz:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-win_amd64.whl.

File metadata

  • Download URL: pls4all-1.0.8-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pls4all-1.0.8-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 191f65ced9d53ada25e82f337fbfc2c8e51257c51e7c2f9e69316d5350d71781
MD5 7ef0cea03e08cf800a90021134b54837
BLAKE2b-256 1ab21a816068bafbf66a0a21a793ec20808405191483f2b65c73064a62bd63b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-win_amd64.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.8-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b345f090aa59a24c68ec3961181eefeb54ac5e52cf031f0b0ddd52e621bc2375
MD5 399c90f7c65c9954bbdd1acc01beb1b3
BLAKE2b-256 c7eee8375d9c10c53c950b1d428421327b60207d7f079649d26252cf003dff66

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.8-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 17b631ff8607769442b8167a2ee8bb12cf62455eefea3e42ae83395926c261c1
MD5 614ba6f4d32c3f1cb8c72dbeae2489d3
BLAKE2b-256 a244c03990c26e0d442009d22a918161cab6a666324b495d5a2c1b5e66d31b6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-musllinux_1_2_aarch64.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.8-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf96285b509533f437eafe08d1a8f9c23abdfd428cf096a90c0facb634829dec
MD5 8e5a47782ae5620704dad9d926bc3c4d
BLAKE2b-256 ba9568cd6d739050707a9d842758bb06e046b2a6ee3ba88236a3ac41cd7fea17

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.8-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 de11aa5bc491e9cffce9f25a9cb13b87355683d1ec6d0a745eb9fc19c4959912
MD5 a20c16d43c7aa820ac3848a55597fa52
BLAKE2b-256 092ba5e3a12b5b6e6bd980d51acab2ec3aa097a1ba24a34cf448bae65e8e5f94

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pls4all-1.0.8-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pls4all-1.0.8-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 2f247950071ae7073b07178467b6433e5841b88dca70d77fdf88147584408142
MD5 3230abcaf52bec8129517baf4911385b
BLAKE2b-256 f0737b83500a652c871e440f3da9b4f0db50342135654d48ee2586d03f90c8cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.8-py3-none-macosx_11_0_universal2.whl:

Publisher: release-python.yml on GBeurier/nirs4all-methods

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page