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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

File metadata

  • Download URL: pls4all-0.97.3.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.3.tar.gz
Algorithm Hash digest
SHA256 80d3a4fb04d818a2a97bd5481add6c79ae3d5d144cbd42404c8f2674b64db964
MD5 077e08569556c74e211ec80975539c61
BLAKE2b-256 d5e7d3ebd15f3ba03af4611f28f630573e5954ac624257a85d2f9fb266675673

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-0.97.3-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.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 385f20bddd4851862391021a93abc45cacc885dc4bc4a2624b1584294b4c53e3
MD5 5075e5bc2ee704d9a577eab010abc7ef
BLAKE2b-256 0966cdddc6908b76aa2a7a481d433e60d67f86d99f61f1d67d4f3c5088fb7ddf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.3-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5e7d4de205e119996eff1ae57daf902076f7ec56bbc070c5971c0d78f75b56f3
MD5 26a7edfa3672fefbb07862f0981fbda5
BLAKE2b-256 3bb80dabcdd3b28db71b1cb6ad6425f4359dc312488c7944339cbb5c4ae36540

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.3-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5e157d17340165f97b32568b998dae3adfcf0a3139e3c0fc0e5da6605e1bb1b8
MD5 cc235b8100677716d69af36ce9f6e384
BLAKE2b-256 fc808ccd5c7efb8029d07bac2edff5e91ec90b641fbfc13b58cf4c23cbab7c85

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 590bca91e5fc5679d8088c80a6d4fe0e5212ddd31264bebe4e71f63a58d8a766
MD5 2f9dae0617c62629acd7328909ce039a
BLAKE2b-256 e105aa8e5c6ded2c8f952eb515e0411c6afcbcecd113cf82443e592e854a5202

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6edda6a39660d2e588bd6481f240fe0f95a6bd4eb5bdc01765788da1b15a3a7f
MD5 0566598d2f61547e4b38d8d143b3fcad
BLAKE2b-256 770197383c9e470e9e4840e628878454dbf807ecda630ffa3e8f984e5d93485d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.3-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 1fa79e264372d413ebac58e6c644b373f69fed803bd8fa87a154a90089dd7788
MD5 b5c39f9699b6389c9d4493340087e622
BLAKE2b-256 20334c134b561042e7d210f3413f0835fb349c34a442922b121acd8c468bd106

See more details on using hashes here.

Provenance

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