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

Uploaded Python 3Windows x86-64

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

Uploaded Python 3musllinux: musl 1.2+ x86-64

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

Uploaded Python 3musllinux: musl 1.2+ ARM64

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

Uploaded Python 3manylinux: glibc 2.17+ ARM64

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

File metadata

  • Download URL: pls4all-0.97.0.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.0.tar.gz
Algorithm Hash digest
SHA256 7957c4938b3b19d94c5c126acde543f7983efd9b87347a96a8a86777b132c559
MD5 00ec35d576615dcc3e4212c3f4e7c408
BLAKE2b-256 f21d9f07f8230672d58f9a6a05effaced108df0b300ee6242d418f1ea62ee220

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pls4all-0.97.0-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.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1a20da5ae55390080b681d141f6d3f83c45865297c8b67f076bea82073cf12b9
MD5 f98a55b9563ed3348acc186cfd9cbc03
BLAKE2b-256 284a666ba1ec6e58ceb7f94151c6f0b0c67ef44ab512740d42a307d16720bb79

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f9f2923d54b664239cefdb331621b668b2fb2bde245b5496dae385babc8fac16
MD5 4833b12116e66f3f92fbe722ef6f57a0
BLAKE2b-256 bca7edcfa3f0902d882cf7403f153bbc89a852ca22d420f77466864443cf4808

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6f91341bbfce98bc7ca1f028a778cc7ec24de3cac13a21e658e0176a3405000f
MD5 9f1345171aeb5bfa4c13f7e3c1ab49d9
BLAKE2b-256 d2592d9ead2a728b8e7cd477f02f9063b07840909c2800359cd8a61f67314727

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d26da68af9867683119bf45cb95c14c2aadd6e2fbfb8e9bf091458413eb4d89
MD5 5af2b34f695610a63d534bc02b0e2c49
BLAKE2b-256 d9ddbac8c1c2aa57050257a81a6a656d881a107d730f80a4b72f3f30127b1e12

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 15b2c4e5361d5e1d99fc2ca66c422701989ac88b2941467045b154161148da4b
MD5 a22a4f40335301911e788feef012d12d
BLAKE2b-256 62d7dedfc2b883fcb32438d112d9a3eea3d666a507679cb1047d983ef0ed1d69

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pls4all-0.97.0-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 d2bbb85f21c216ac55da7abde064638f6e866fc25aa2f754019800d24f88a455
MD5 12b40e52be5d9a730efa2f23c9ba91ea
BLAKE2b-256 2b44413e0ac4cca778807230602b9f6d061b96f674b9780647a2709cd0aa9c05

See more details on using hashes here.

Provenance

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