Python bindings for ALP GraphBLAS (minimal package layout)
Project description
pyalp (packaged)
This directory contains the Python package layout for the pyalp bindings
that expose parts of the ALP GraphBLAS project via pybind11.
Quick start
Create and activate a virtual environment, then install the package (example using PyPI (recommended):
python -m venv venv
source venv/bin/activate
pip install alp-graphblas
If you want to try a pre-release from TestPyPI instead, use the TestPyPI
index but install the same package name alp-graphblas (pip will pull the
package and its dependencies from the given index):
python -m venv venv
source venv/bin/activate
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple alp-graphblas
Basic usage
pyalp (packaged)
This directory contains the Python package layout for the pyalp bindings
that expose parts of the ALP GraphBLAS project via pybind11.
Quick start
Create and activate a virtual environment, then install the published package
alp-graphblas from PyPI or TestPyPI as shown above. Note: the import name
inside Python remains pyalp (the package provides the pyalp module), so
your code still does import pyalp after installation.
Basic usage
The package exposes a small set of helpers and one or more compiled backend modules. Use these helpers to list and select available backends and to read runtime build metadata:
import pyalp
print('pyalp build metadata:', pyalp.get_build_metadata())
print('available backends:', pyalp.list_backends())
# Import a specific backend module (returns the compiled module)
backend = pyalp.get_backend('pyalp_ref') # or 'pyalp_omp', 'pyalp_nonblocking'
print('backend module:', backend)
Backends and import caveat
Wheels may include multiple compiled backend modules (for example
pyalp_ref, pyalp_omp, pyalp_nonblocking). Historically, importing
multiple different compiled backends in the same Python process could raise
pybind11 registration errors (types duplicated). The bindings now use
py::module_local() for core wrapper types, which reduces collisions, but if
you encounter issues importing more than one backend in-process, prefer
testing each backend in a separate process (the supplied test runner does
this).
Runtime metadata
The package provides a metadata module generated at build time by CMake. Use
pyalp.get_build_metadata() to access keys such as:
version— pyalp package versionbuild_type— CMake build type used (e.g., Release)alp_version— ALP repository version or tag used to buildalp_git_commit/alp_git_branch— Git information captured by CIlicense— detected repository license (e.g. Apache-2.0)
pyalp.get_algorithm_metadata() contains algorithm/backends info and a
readme key with packaged README contents.
Minimal example — conjugate gradient (small test)
Save the following as test_cg.py and run python test_cg.py after installing
pyalp and numpy. The example shows selecting a backend explicitly via
pyalp.get_backend() and then using the backend's Matrix, Vector, and
conjugate_gradient API.
#!/usr/bin/env python3
"""
Test script for the pyalp backend (example uses the OpenMP backend name
`pyalp_omp`, but you can use `pyalp_ref` or another available backend).
Usage:
python test_cg.py
Dependencies:
- numpy
- pyalp (installed and providing a backend such as pyalp_omp)
"""
import numpy as np
import pyalp
# Choose the backend module (change name if you want a different backend)
pyalp = pyalp.get_backend('pyalp_omp') # or 'pyalp_ref', 'pyalp_nonblocking'
# Generate a small sparse linear system using numpy arrays
N, M = 5, 5
idata = np.array([0, 1, 2, 3, 3, 4, 2, 3, 3, 4, 1, 4, 1, 4, 4], dtype=np.int32)
jdata = np.array([0, 1, 2, 3, 2, 2, 1, 4, 1, 1, 0, 3, 0, 3, 4], dtype=np.int32)
vdata = np.array([1, 1, 1, 1, 0.5, 2, 1, 4, 4.4, 1, 0, 3.5, 0, 3, 1], dtype=np.float64)
b = np.array([1.0, 1.0, 1.0, 1.0, 1.0], dtype=np.float64)
x = np.array([1.0, 1.0, 0.0, 0.3, -1.0], dtype=np.float64)
r = np.zeros(5, dtype=np.float64)
u = np.zeros(5, dtype=np.float64)
tmp = np.zeros(5, dtype=np.float64)
# Create the pyalp Matrix and Vector objects
alpmatrixA = pyalp.Matrix(5, 5, idata, jdata, vdata)
alpvectorx = pyalp.Vector(5, x)
alpvectorb = pyalp.Vector(5, b)
alpvectorr = pyalp.Vector(5, r)
alpvectoru = pyalp.Vector(5, u)
alpvectortmp = pyalp.Vector(5, tmp)
maxiterations = 2000
verbose = 1
# Solve the linear system using the conjugate gradient method in the backend
iterations, residual = pyalp.conjugate_gradient(
alpmatrixA,
alpvectorx,
alpvectorb,
alpvectorr,
alpvectoru,
alpvectortmp,
maxiterations,
verbose,
)
print('iterations =', iterations)
print('residual =', residual)
# Convert the result vector to a numpy array and print it
x_result = alpvectorx.to_numpy()
print('x_result =', x_result)
# Check if the result is close to the expected solution
assert np.allclose(x_result, np.array([1.0, 1.0, 0.0, 0.13598679, -0.88396565])), 'solution mismatch'
Packaging notes (for maintainers)
- The CI uses a top-level CMake configure/build to produce the native shared
object and a CMake-configured
_metadata.py. The packagingsetup.pythen copies the built.soand_metadata.pyinto the wheel. - The CI passes Git/version information into CMake so the generated metadata is populated even in detached/CI environments.
If you modify the metadata template, update pyalp/src/pyalp/_metadata.py.in.
License
See the repository LICENSE at the project root; the packaging pipeline
attempts to detect and embed the license string in runtime metadata.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alp_graphblas-0.8.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ac87db8872e9e3ba002cf821e4a5e56f2ed4f92f38da033673c967204da1a82
|
|
| MD5 |
6ab5f685d86f8e82f0213ed4d6caa813
|
|
| BLAKE2b-256 |
77a22825895c91dfca22ead46fa766bfa280f0e84822e690941bfb632d5711e5
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
9ac87db8872e9e3ba002cf821e4a5e56f2ed4f92f38da033673c967204da1a82 - Sigstore transparency entry: 662994779
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp312-cp312-macosx_15_0_arm64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp312-cp312-macosx_15_0_arm64.whl
- Upload date:
- Size: 492.9 kB
- Tags: CPython 3.12, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62624ccb8f1ca823b7627ff56ecf7cca11d656cd4e97ba9fe8b3f2557f4eda07
|
|
| MD5 |
f091ccde4a024a10c84a76ba4b21d2df
|
|
| BLAKE2b-256 |
8dac9d74b412dde71d04bdff065355d80e179c32dd28955e06f911b4b3e29948
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp312-cp312-macosx_15_0_arm64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp312-cp312-macosx_15_0_arm64.whl -
Subject digest:
62624ccb8f1ca823b7627ff56ecf7cca11d656cd4e97ba9fe8b3f2557f4eda07 - Sigstore transparency entry: 662994784
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c12c56cd2ac8a462280bb1cf7fbbbc88b4eced771c633f69a736a3e1608085f
|
|
| MD5 |
ce4d2364cab7c31a4527317ccd31c874
|
|
| BLAKE2b-256 |
745b6e1dbadd1934066612cfda7ccaf04e2851e0d2859278d73eabfad961cdc3
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
6c12c56cd2ac8a462280bb1cf7fbbbc88b4eced771c633f69a736a3e1608085f - Sigstore transparency entry: 662994777
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 492.9 kB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39f3c89563f9c4d3be019713d9c0dd606c203e0a31b428bb7e1ccea9836bc636
|
|
| MD5 |
8a6f3794a84c867d5233fe04c26fa775
|
|
| BLAKE2b-256 |
1990a118f708479de10c3445e547a3ff6bc9a914c32c2955e86a3c335570af37
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp311-cp311-macosx_15_0_arm64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp311-cp311-macosx_15_0_arm64.whl -
Subject digest:
39f3c89563f9c4d3be019713d9c0dd606c203e0a31b428bb7e1ccea9836bc636 - Sigstore transparency entry: 662994789
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe7e9188238de5b702e0eedc50e9917f470816945bde3ec357750a4c034207eb
|
|
| MD5 |
094a31da1fc03080880f4cf35d742e15
|
|
| BLAKE2b-256 |
5bfb02264329660b30a31225cc5568fdc19ac6bcec2eab25cc314b50d3215e83
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
fe7e9188238de5b702e0eedc50e9917f470816945bde3ec357750a4c034207eb - Sigstore transparency entry: 662994796
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp310-cp310-macosx_15_0_arm64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp310-cp310-macosx_15_0_arm64.whl
- Upload date:
- Size: 492.9 kB
- Tags: CPython 3.10, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9defbfd725c9d292e4b6fb2c2eded7ab97e7ca3ea542d98a4e4b3b436d89be4
|
|
| MD5 |
cded507995c3df7421d4732405e9216f
|
|
| BLAKE2b-256 |
b085a42c520abb72a039f92773a69bd73fcb1682eac2c2bc9eeb5157d6c6f0a2
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp310-cp310-macosx_15_0_arm64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp310-cp310-macosx_15_0_arm64.whl -
Subject digest:
c9defbfd725c9d292e4b6fb2c2eded7ab97e7ca3ea542d98a4e4b3b436d89be4 - Sigstore transparency entry: 662994794
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b18ffa7d52af1358a4cd6178540f2397f80b4e0855af51e62f24ab2e0173b098
|
|
| MD5 |
4c2dfdf2a39e201cb5e67c9e2e371c38
|
|
| BLAKE2b-256 |
51c2062db933a57c8930a8d9a4806d50698ee8ef8eb52e4e21fa3f292dc99410
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
b18ffa7d52af1358a4cd6178540f2397f80b4e0855af51e62f24ab2e0173b098 - Sigstore transparency entry: 662994799
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file alp_graphblas-0.8.38-cp39-cp39-macosx_15_0_arm64.whl.
File metadata
- Download URL: alp_graphblas-0.8.38-cp39-cp39-macosx_15_0_arm64.whl
- Upload date:
- Size: 492.9 kB
- Tags: CPython 3.9, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2d45ddf926959de8f36dbf1cf2e4e513b5f4c8108a2e962e94140116f8f05d
|
|
| MD5 |
3cdf20783d2945b68e2ced12c7cf48d2
|
|
| BLAKE2b-256 |
ee56d60034ba06d840ffaed3ddb3fcce8d0e167060b6c7e198ead50d08fabca1
|
Provenance
The following attestation bundles were made for alp_graphblas-0.8.38-cp39-cp39-macosx_15_0_arm64.whl:
Publisher:
promote-to-pypi.yml on Algebraic-Programming/ALP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alp_graphblas-0.8.38-cp39-cp39-macosx_15_0_arm64.whl -
Subject digest:
8c2d45ddf926959de8f36dbf1cf2e4e513b5f4c8108a2e962e94140116f8f05d - Sigstore transparency entry: 662994807
- Sigstore integration time:
-
Permalink:
Algebraic-Programming/ALP@17a0710b242732f95767d0ec1188433b26ad6976 -
Branch / Tag:
refs/tags/pyalp.v0.8.38 - Owner: https://github.com/Algebraic-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
promote-to-pypi.yml@17a0710b242732f95767d0ec1188433b26ad6976 -
Trigger Event:
push
-
Statement type: