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.2+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.2.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.2-py3-none-win_amd64.whl (1.3 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

pls4all-1.0.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

pls4all-1.0.2-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.2.tar.gz.

File metadata

  • Download URL: pls4all-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7c41ee69c6b73f917a1c81d1a365a9b185f3b146c8d4c4e6daaf5d18f945db56
MD5 f4eff7043af3634c94271d9e279f2c0d
BLAKE2b-256 8bd16ff6699f2fe497bda095deed24ba9d5d2931ed9f65280226c1151bf0bc4f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-1.0.2-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.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e03cc45aa5a9c3f01cd206db5ecee07d8601b34f7b31898b247c8ba08d86ee94
MD5 6ebbf4a57547ea85fc0bb9a2d3332152
BLAKE2b-256 48f2e4b16e489c9ba26b9c3f50b52c02e8c01f0ef2aa8530f2afeda1cf5304b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 896444e53763c0d0bb117b20ff8867b7b9b584afdc511de6e5f630256591ce3c
MD5 3d181b896a122e295f30d083c13d1391
BLAKE2b-256 681ebee914b38a4475b093f63d4748d0ce4920575d8d47d26001081f79668fe7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 255f2aa8c17c01b2f57d636244a8183be8765f2bada6d4a51337c65303e3cd1c
MD5 74ecb299e5f6e892173e5732f2d7730b
BLAKE2b-256 ff59e0d43366ccbc7987ed8a1636403be92443536921cb0500fd61a5992cf2b4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07439fdd50bfbd22d8ad74088542707ecdcf6b0b4a2b34c9fb72cbefbc5c62ad
MD5 8c544df5be76348e757656773b538717
BLAKE2b-256 a2d0f6ee21eadd11f70d6b058f038872dc22e18b2f7b56ed6a45d610116af080

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-1.0.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-1.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c0ebacd7489e3a747ff3af6a233cef6f34bbe2cc2414c31f6de46c2821581593
MD5 7c6140b6d0bf734f4ffcfa03d6fe5e2f
BLAKE2b-256 4303364315e7680920b64b825437f2ad68077a3ab4a7334d0e3d9a722ea07e55

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.2-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 f8c5fa047d92759e99d62c9376d077940da55d0e0876ac3e3f16798e6b65f4f4
MD5 723de1e3eb76986014d1956a73144e76
BLAKE2b-256 11b4f878e4f4ad4df53f75074078298ca579198037433951cbfedc81396a9b08

See more details on using hashes here.

Provenance

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