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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

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

File metadata

  • Download URL: pls4all-1.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 985476f2de0d4c9f3a0c1ecdc7d78a36ae40d837d4e1bbd0fc99193a639bd468
MD5 1702faf62815070354e0f3b1198e5635
BLAKE2b-256 7e9d88198e7ed2dd8d97e1f6884a5acedcb3b50d7ccbd3843ad5616557f66366

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-1.0.7-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.7-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a80863c4fa181536bf8765c26cac1e28b82ea985b4e83c33a21f30c16f191117
MD5 70d1f9c2f95a2cc2a63fcda90e6523a4
BLAKE2b-256 73a28e6c1582cf5b1f2134d855fe101cca1c75f0972a7a44c218f62bc0e5a479

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.7-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 816a25c8f87328c9968dbc7d37605711a6984ca9aaf9a03d7459c082844059a6
MD5 e4e1ca5dafe12c2d28b404c9fc4653a8
BLAKE2b-256 579a84b722bcea680c1cc14e55aa1867a5302562e8f58ace121d6b5847287935

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.7-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c7fe99819ffd7cf497e070e5abb70fa54518b56a79e193bd8e0d4d5e50a79e17
MD5 6aa1d43c429288e8e61090d8af83672c
BLAKE2b-256 77496e7e0fa1e1ed1457b26c8049f7f4b6635fd3416724c11ac9132af1a31c95

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.7-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1b16f60d12e5436293b04c0be40ca5d368405d416e9df8b231d379eb0a8af8bb
MD5 34ab082bac5242c67e06a3cd0e2ead0b
BLAKE2b-256 af32718ba245f3b6fb90bf05a4d99ee511e6435eeacd463cbd451efa3d5e886f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.7-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 949650ae49dbd102c9999980b842dabeaf8063db9c2a06e5c18ab685b30e25e3
MD5 14c23a44a1155f56e10b34aa1f380a79
BLAKE2b-256 35e995cf4b62347a5ca9ba192cfa1cf3c0c38c94074a3de828ce65ee6b68b59c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-1.0.7-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 d398d363a551fa5b9b5687128a79c920d0dc8eff6b8da981a40cb0d81701e6ff
MD5 4269543b0b64aaa5f5fe63c539086536
BLAKE2b-256 5ebd3535da108d79ae998d2ebee7bce82de0aae0756eff47ba45d0395bcd0e21

See more details on using hashes here.

Provenance

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