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.2.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.2-py3-none-win_amd64.whl (767.4 kB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

File metadata

  • Download URL: pls4all-0.97.2.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.2.tar.gz
Algorithm Hash digest
SHA256 a843fe1d18b1a3341637c156d45cb7dffc8e0393e14a93771628afa209774c0b
MD5 cb064d414af6539f5dc4da7b7a0380ad
BLAKE2b-256 7c24539b77c45c1cb779cc0a81a458df9cc8ea971bde1790a70200c7672e4807

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-0.97.2-py3-none-win_amd64.whl
  • Upload date:
  • Size: 767.4 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.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f405553ade36c666e087488ef6352caf0ddccb2d6a1261d61bd0e3b324f06bbb
MD5 d7b8447756e93075cf3a9ca293bd7711
BLAKE2b-256 45e2aaa75d6c3a40d991269284fefdaf2b00c8f353178774e16556301bef7b64

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 49de65b458d8a7a03612bddcae2948969bf7c852c75d3386c55fc352cfaf8a11
MD5 c04d50da4b071745e3af14bdc8cc663c
BLAKE2b-256 294ed5d6004f4c91272699fc02fe369e11808cd062a42a1a97acd353f0831f06

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 02599b2b21833df49b52697133c0f4d2bac14347580328087938bf7a30dea922
MD5 a1ecfa403a7e0fe241d92ab828538303
BLAKE2b-256 98b419956bc412a2462224971594259031dda7ca99f583bab6b32b5af667a5e8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 759ca28250a86fe180cf24eda1ed45d86f51f1daf8ba6a627e3109100b3c6959
MD5 4af48fcf7520ac33884422f4ef1bbf1f
BLAKE2b-256 555f5371bff0e2b3efb0653db6ab113431f8448e560bff0d50797b3e95bd3e05

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 109d7956cf39d1e716009473a4bf98080739c4b9528ca14b994cccc10252701c
MD5 962a40d8075306ab221a5f404939eab9
BLAKE2b-256 cebe66b30ea21f5ddb19375a330d1259eb1df5a2fa30ddbc9a015c81523e628d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.2-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 e5c9c474c6dbe431812331d75fbca27c54cefa4e40b5b9d528e0f4c85d6f6b64
MD5 51b1c6527abe0a4ec1119acaa86b699f
BLAKE2b-256 f21b80f925c8366183d457ad189edde8c923baa5d0a036f4def871321dfaf64a

See more details on using hashes here.

Provenance

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