Skip to main content

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

Project description

Python binding

The current Python package ships a minimal ctypes-only binding that:

  • loads libp4a.{so,dll,dylib} via ctypes.CDLL,
  • exposes the version / status / dtype / backend introspection queries,
  • exposes a Pythonic Context and Config wrapper for the lifecycle calls,
  • raises a typed exception (Pls4allError) on any non-OK status, capturing the per-context last_error message.

A real wheel with NumPy zero-copy p4a_matrix_view_t conversion + a sklearn-compatible estimator lands in Phase 2 on top of the live C core.

Build the underlying library

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

This produces build/dev-release/cpp/src/libp4a.so (or .dylib / .dll). The binding looks for it on disk via the loader rules below.

Loader rules

In order:

  1. $PLS4ALL_LIB_PATH — explicit path to libp4a (most direct).
  2. pls4all/lib/libp4a* next to the installed package (wheel layout).
  3. <repo-root>/build/dev-release/cpp/src/libp4a* (developer convenience).
  4. The standard system search path (LD_LIBRARY_PATH, macOS rpath, Windows PATH).

Smoke test

import pls4all
print(pls4all.version())       # "0.96.0+abi.1.13.0"
print(pls4all.abi_version())   # (1, 13, 0)

with pls4all.Context() as ctx:
    ctx.seed = 42
    print(ctx.last_error)      # ""
    try:
        ctx.backend = pls4all.Backend.CUDA
    except pls4all.Pls4allError as e:
        print(e)               # 'backend 5 is not compiled into this build of libp4a'

with pls4all.Config() as cfg:
    cfg.algorithm = pls4all.Algorithm.PCR
    cfg.solver = pls4all.Solver.SVD
    cfg.deflation = pls4all.Deflation.REGRESSION
    assert cfg.algorithm == pls4all.Algorithm.PCR
    assert cfg.solver == pls4all.Solver.SVD
    assert cfg.deflation == pls4all.Deflation.REGRESSION
    cfg.algorithm = pls4all.Algorithm.PLS_SVD
    cfg.deflation = pls4all.Deflation.CANONICAL
    assert cfg.algorithm == pls4all.Algorithm.PLS_SVD
    assert cfg.deflation == pls4all.Deflation.CANONICAL

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-0.97.1.tar.gz (59.0 kB view details)

Uploaded Source

Built Distributions

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

pls4all-0.97.1-py3-none-win_amd64.whl (766.9 kB view details)

Uploaded Python 3Windows x86-64

pls4all-0.97.1-py3-none-musllinux_1_2_x86_64.whl (2.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

pls4all-0.97.1-py3-none-musllinux_1_2_aarch64.whl (2.5 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

pls4all-0.97.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

pls4all-0.97.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

pls4all-0.97.1-py3-none-macosx_11_0_universal2.whl (3.4 MB view details)

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

File details

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

File metadata

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

File hashes

Hashes for pls4all-0.97.1.tar.gz
Algorithm Hash digest
SHA256 cabcc2e1244e22f52cdbf5453225c7b13efa2230c5d8e4ee409089515a7e3660
MD5 d9e4bcd0cb63ace6fd41b16ea2333a73
BLAKE2b-256 8a243a5e5095aaecf7780fc4ec91edf09653c6fcc093f23f0374352dd6332040

See more details on using hashes here.

Provenance

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

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: pls4all-0.97.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 766.9 kB
  • 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-0.97.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 0ea54ca2ebf1e6a4c06f9b62a7781fd897c57c7a28ef5c8bec0356ee487ceaa8
MD5 38f625c207e00d6489fa14c58f98d434
BLAKE2b-256 778521776cda3bdee01c47d69143d2728e1a97d074b9d75423f6ae726db534b5

See more details on using hashes here.

Provenance

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

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-0.97.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e1bcc092f83b79b2b84b61b09c72b35a5a2da858d50e188f772f5ec99649499d
MD5 0c58aa42a9e8a592d21bf9747fe6e337
BLAKE2b-256 53e2995e2236c7eefcb6ad22d408dc60089241557edf1c2927f0152c17cfa623

See more details on using hashes here.

Provenance

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

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-0.97.1-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 2b1639e310e5225ac717825a5e7473bc9e3dd88095e37efebb081b9d7fd67459
MD5 70a5270ac875dfa6db5048a37c46d279
BLAKE2b-256 8d99abea47a5589af0ca96c3a95c7d6debeb7f4c0bad209db5114e1433ee73ef

See more details on using hashes here.

Provenance

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

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pls4all-0.97.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b6685006821c7a445679732ffb79274d0f3c4b7f955a8e7eea13997f6281691
MD5 5ad5746681cf32005e22e98f3fd4b0d7
BLAKE2b-256 9197cb5b971178dab136f6f205f1710bb8e16304a4062a7613e201e98232b8f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-0.97.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pls4all-0.97.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7ab37177f340a509cf1f48d11c5c234a5ed87c7c5f3f994dfe0949eaa7a9f393
MD5 946da650a86ad560e6a7b9e0013825c4
BLAKE2b-256 1d58c8f576946c9c7c9cdab9fbfceb7343f09208647687e461ba54dec0bc9d2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pls4all-0.97.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on GBeurier/pls4all

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-0.97.1-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pls4all-0.97.1-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 c7a79b5507fc0c194ca4b3a20ea31c3b0f3dc28b515d0f9726b90c970b256a17
MD5 4a6dbae179c501baa902676251bd1b1e
BLAKE2b-256 ca57ff14af731dba8bf291414147c7830f1fd85d62122cbfcea3a430918d0559

See more details on using hashes here.

Provenance

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

Publisher: release-python.yml on GBeurier/pls4all

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