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.5.tar.gz (130.2 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.5-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

pls4all-1.0.5-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.5.tar.gz.

File metadata

  • Download URL: pls4all-1.0.5.tar.gz
  • Upload date:
  • Size: 130.2 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.5.tar.gz
Algorithm Hash digest
SHA256 85a8dcd3c8b7f3bfbb9cc2a7d25254acaeb30efe8e68a314410cc5066c1293ad
MD5 3b1bc5ffd14d77bdbb0b22bebb9ab14e
BLAKE2b-256 84a68bad5d4e44c608e4cf6a805f95e535bcff1a7d3122b43f67ad0a71ddffe8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-1.0.5-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.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6efab5e871eaeb0850c1c526a4785ff592b7e44b25f6b39111807a00f116bd9a
MD5 0cbff952b6994274b9ad6850d1870708
BLAKE2b-256 cd5e6f4e3afa192d6c49df59773b534323ddec7b61d2119ce3ce06de303de4bb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.5-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 55d0bdb12734654315eaf608513b9a6c16e5b98ed39a007c3faa4c1589f9cb1c
MD5 bc017f2ccb97a9461e40c4362faafe64
BLAKE2b-256 55645b742842d8288eff8d0d598967e9c94417a55ffb8da68f546320d2b726d3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.5-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3106fa734d54ac0fb1573a042c0a5edf299d7962534c05126a3c1e188f630907
MD5 21d71976f281d72899b7fb411344bea9
BLAKE2b-256 0034ce7700a90ddc33e28c78f017d957931b851b93ba78ed8f5b4769d82e41bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.5-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.5-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.5-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e87dcbce76e9dbd8b5312e2d5758d736682c03f13dd15666654b97e2e4b6af3
MD5 5c026fce6b9565bfd64aa9ee2b7c44fb
BLAKE2b-256 3c0c1fcb116d01cf0125e2e08add7f92726cb7c6a9f400ff49364d4c2b9ffa1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.5-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.5-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.5-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 31de8e46003e40bdf4f708b9d95994840495eb98f13caaabee1e1c4eef7b8d57
MD5 ff15cdc31b583eeb4ccd1e4504e99bff
BLAKE2b-256 629c3fb0da0b96a704812aff9397b1c767aaa34938ccb5466c4a4fd6db797087

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.5-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.5-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pls4all-1.0.5-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 6cdaa07a59d0e17173e36dbe7337e750ebcb1a18b2c0f5c2f2b6e9c1901f64b9
MD5 d6e161487475a1b69cb9692d11403a64
BLAKE2b-256 1b2ff9d53821527e55894236c7a2c94feee6f52a1d4bd2944a7b92d37f507e96

See more details on using hashes here.

Provenance

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