Skip to main content

Python binding for the pls4all C ABI — a portable PLS / NIRS engine.

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 — 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. "0.98.0+abi.1.9.0"
print(pls4all.abi_version())  # (1, 9, 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 (most direct),
  2. pls4all/lib/libn4m* next to the installed package (wheel layout),
  3. <repo-root>/build/dev-release/cpp/src/libn4m* (developer convenience),
  4. 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.1.tar.gz (126.1 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.1-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

pls4all-1.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pls4all-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

pls4all-1.0.1-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.1.tar.gz.

File metadata

  • Download URL: pls4all-1.0.1.tar.gz
  • Upload date:
  • Size: 126.1 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.1.tar.gz
Algorithm Hash digest
SHA256 93125e71b96fb25fd7c277efb34fdde1c748939e67aa1e15b35ec8a8fa6bb3ce
MD5 e79e4fc99f5d10160781cc4ffbfb801c
BLAKE2b-256 1055dbd3bd5c62f74c19917d246acaf3044516e63db401408711084b08367f35

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1.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.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: pls4all-1.0.1-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.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 77fb578bd7e8a107702929fe66507d43c65b77cd760ef128f76e824a377e09e7
MD5 b57b0c6ef65b0c4cbb6029ab7df80ed9
BLAKE2b-256 750b525a2430a3e52b639b92272da80d788b4465a9d33b33712344a04c14f6c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-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.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d932fc082909058107127dd55aa5ff63b47d219dab8e7f5bcdc2121bfdbaf2c7
MD5 3bf1ce051525996d2a5e38393d7b6fd7
BLAKE2b-256 9997690f7cf1f22d31ccebc56f89586f2ad1617d572f64aa697d7e9e458d1524

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-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.1-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c2ee97e28a799bc17d93bc0d56059327a2912262b84113721e26dbdca902ef24
MD5 5695d0d45cb0f591a8d407d839569f18
BLAKE2b-256 54f218fc549dcb335e4a4e01ea32b77defd2d2b72c993fe634a1d29ab0254cf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-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.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a204bceadcf4e9ecd8bfa6a4746d16ad1b0d21b6d23fea81d1a673b9594e044
MD5 7154772d4d8ce2d2a89f3fc5288791d4
BLAKE2b-256 3c9c5b4afae6b962dfd6fe703c33c2b8617c98249f3dfef4931c10b3e1203387

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_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.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8197ad625de70c69171ee98b60b0d3b03328897fe9eb0d3e7c9314dc37e74b18
MD5 3ae65fe028b780c704eee7e863df12af
BLAKE2b-256 571cef8eb743f3c917fb5993bab0d766398e540c20c16e3c97b43c35f33a7aee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_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.1-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pls4all-1.0.1-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 31d7dd6bae253f883ee488d8761dd8888fad0e531d2df8202f4fdce74567d92e
MD5 613bd802ecb0b65513a8952a6c0d9363
BLAKE2b-256 08a47b55df5b7ac82c2b0653ef52f024aaa555084c99d51f1c88d095c9f4f8cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.1-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