pylibstats
Python bindings for libstats — a C++20 statistical distributions library with SIMD batch operations.
Features
- 19 distributions: Gaussian, Exponential, Uniform, Poisson, Discrete Uniform, Gamma, Chi-Squared, Log-Normal, Student's t, Beta, Weibull, Rayleigh, Pareto, Von Mises, Binomial, Negative Binomial, Geometric, Laplace, Cauchy
- NumPy integration: pass arrays directly to
pdf(),cdf(),log_pdf()— the SIMD/parallel batch path runs automatically - GIL-releasing: batch operations release the Python GIL for concurrent workloads
- SciPy-compatible naming:
pdf,cdf,ppf,fit,sample - Input validation: all constructor, setter, and
fit()parameters are validated in Python with clearValueErrormessages
Quick start
import numpy as np
import pylibstats
dist = pylibstats.Gaussian(mu=0.0, sigma=1.0)
# Scalar
dist.pdf(1.0)
dist.cdf(0.0) # 0.5
dist.ppf(0.975) # ~1.96
# Batch (SIMD-accelerated)
x = np.linspace(-4, 4, 100_000)
densities = dist.pdf(x)
# Sampling
samples = dist.sample(n=10_000, seed=42)
# Fitting
dist.fit(samples)
Building from source
Requires Python ≥3.11, CMake ≥3.25, and a C++20 compiler.
pip install .
This fetches libstats via CMake FetchContent if not already installed, at the
version pinned in CMakeLists.txt (find_package floor and GIT_TAG).
Building against a local libstats
To link against a locally built libstats (e.g. a development branch), install
libstats to a prefix and point pip at it:
# In the libstats repo
cmake --install build --prefix /path/to/libstats/install
# In this repo — use libstats_DIR, not CMAKE_PREFIX_PATH
# (overriding CMAKE_PREFIX_PATH breaks nanobind discovery)
pip install --no-build-isolation -ve . \
-Ccmake.define.libstats_DIR=/path/to/libstats/install/lib/cmake/libstats
--no-build-isolation requires build deps in the active environment:
pip install "scikit-build-core>=0.10" "nanobind>=2.0"
Running tests
pip install ".[test]"
pytest
Examples
See the examples/ directory:
basic_usage.py— scalar/batch operations, sampling, and fittingbenchmark.py— wall-clock comparison against SciPy (PDF and CDF)scipy_comparison.py— numerical accuracy verification across all 9 distributions
Known limitations
- Beta CDF performance: the regularised incomplete beta function in libstats is slower than SciPy's implementation (~0.5× speedup). All other distribution/operation combinations are faster.
Contributing
macOS ABI note
From v2.0.0, libstats only supports the system AppleClang toolchain on macOS — the alternate Homebrew LLVM path was removed. Both libstats and pylibstats are therefore always compiled with the same libc++, so the v1.x ABI incompatibility (mismatched exception-handling ABIs causing segfaults) no longer applies.
Pylibstats still validates all parameters in pure Python (in __init__.py) before calling into the C++ layer. This is retained as good practice and to produce cleaner Python error messages, but it is no longer a safety requirement.
License
MIT
Metadata
Release files for pylibstats 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pylibstats-0.6.0.tar.gz | 55.5 kB | With provenance | Details for pylibstats-0.6.0.tar.gz |
Built distributions (wheels)
Total release size: 66.5 MB
Release files / pylibstats-0.6.0.tar.gz
| Download URL | pylibstats-0.6.0.tar.gz |
|---|---|
| Size | 55.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e8dca221c16453f33105f8514af77ca80890febb0ba099d4a73a0c9d43d9506
|
|
BLAKE2b-256 checksum How to use checksums |
09c9bf46d20414c34b9531990d6b0ede07554cfae324a14996e96b46b1ad6d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp314-cp314t-win_amd64.whl
| Download URL | pylibstats-0.6.0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4f224e42d1506056ff355b87f528e602c34c6cea20360c37b3142f76007813f7
|
|
BLAKE2b-256 checksum How to use checksums |
8ee296b29a955b577312b1d4a8a4aea33685748b43ba93384fbf06a0c1a4f428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylibstats-0.6.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8ecff7b151153121da3966dd045cd7dd18cf4c4bf4f0fbbb4ad4ac238dfb5ffe
|
|
BLAKE2b-256 checksum How to use checksums |
43b50a74f625b63b5e01022c898ae21431d9fc16c4fae94dffd770eec76c8e0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pylibstats-0.6.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
451c1f5fd5f3b12c62e50c6d8c3ce95534c3146dfa8c563705659068434cd1c4
|
|
BLAKE2b-256 checksum How to use checksums |
d103a95831a51a5f2623c0127ada0072cf9f7036674a461c5d0e345cd026cfec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp314-cp314t-macosx_13_0_x86_64.whl
| Download URL | pylibstats-0.6.0-cp314-cp314t-macosx_13_0_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
c705003574f08c6fc476c0e4ebb16802a5d05dc094a2ba42876b9ba9425c6c7f
|
|
BLAKE2b-256 checksum How to use checksums |
d78ee03f4ea45cfbf23073da97d765165c8b1767318e87c0e73b42acd4eea60b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp314-cp314t-macosx_13_0_arm64.whl
| Download URL | pylibstats-0.6.0-cp314-cp314t-macosx_13_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1900703ad040c73032b4bf8abfa4c780bd1a829f19412c7658b5bee02cd9afb5
|
|
BLAKE2b-256 checksum How to use checksums |
4467a07f797522b57c3b49aec160c870953277284b4383e1f2b42d043eaaa90d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp312-abi3-win_amd64.whl
| Download URL | pylibstats-0.6.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2c95917115fb1c717056c8b52c84a55c041b9b447bb27440ffb87955ea56f5ee
|
|
BLAKE2b-256 checksum How to use checksums |
a12440031054f65f6a11e3a1fc0893f4ed2611717aa791b51cfe4da4642f3fb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylibstats-0.6.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
14da9e656c187b56acddc8fd7ac4b58ace93fdcddea4cd6292d66639e94062a3
|
|
BLAKE2b-256 checksum How to use checksums |
c11e16d7acc22330996d74d2ef0553f01135818fd6a99a836053da3c274fd842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pylibstats-0.6.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8951af2cdefc406c8aa9a668d24e5d7c1fdf0a27002a5991d1880fa80fed97e4
|
|
BLAKE2b-256 checksum How to use checksums |
9e8d19e93405426a4d5eec413808b0ce72eb310cd9a21b0eb5106a1229ba1b14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp312-abi3-macosx_13_0_x86_64.whl
| Download URL | pylibstats-0.6.0-cp312-abi3-macosx_13_0_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.12 abi3 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
1788468a5f1cb0beac126b31469f4f4231b99e6044f41c20d37cf1e4a8309ef8
|
|
BLAKE2b-256 checksum How to use checksums |
a6ea8b73821c076de2cb94470d4defce707846c6a54499458f9dcce887031f21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp312-abi3-macosx_13_0_arm64.whl
| Download URL | pylibstats-0.6.0-cp312-abi3-macosx_13_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.12 abi3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9b2157d39bbd9e6ce55c0e6e892d6b76040b1383fc8d0efacd60f3e9ad66e555
|
|
BLAKE2b-256 checksum How to use checksums |
bbe8b2a00ad715a4c8469ce19808608533383ad040be8eb5c1dbbe49faed7d82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp311-cp311-win_amd64.whl
| Download URL | pylibstats-0.6.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
119d6cb863b28ed8a33ae6847b54789ccadaad8ceccba98a0ee217013559126c
|
|
BLAKE2b-256 checksum How to use checksums |
d7ccfadce2f9c0d50ae26d8f430131a87fdbb45243a758132a904cfdada6ea4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pylibstats-0.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
75e1c6ef8c153201f75ee20602decfe6c036466f2981efd8b85cb9dff15c3cbf
|
|
BLAKE2b-256 checksum How to use checksums |
fb78e4e0e7e7099a48fe703165e6b42b182c7b2bbe1d1d0648c42361b004c8f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | pylibstats-0.6.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
a7c9380cfc0bf87b71f5cc552efb78dfbe7b5a43579fa4ffd494d48c2ddc17ae
|
|
BLAKE2b-256 checksum How to use checksums |
f74afa7653729e17b398cee73dcc21f623465732cbdc1741e2883317c6ef81f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp311-cp311-macosx_13_0_x86_64.whl
| Download URL | pylibstats-0.6.0-cp311-cp311-macosx_13_0_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.11 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3afaed8416bffd47eee8b8210f8754d3f93372da708c8c2157116a0fb148ff8
|
|
BLAKE2b-256 checksum How to use checksums |
9c586597fef7bc3004d2f03b039618cfb735d6589d0c35d1eda3c980c763c082
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / pylibstats-0.6.0-cp311-cp311-macosx_13_0_arm64.whl
| Download URL | pylibstats-0.6.0-cp311-cp311-macosx_13_0_arm64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.11 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
55890e619eac2cfaaebf6e6a99621d6f3786056d3d6cec29214a4203aae29106
|
|
BLAKE2b-256 checksum How to use checksums |
f3929d6a343782b45da03d15d511d7249edb97663854dec1c08cffc8f47aecb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logSecurity for pylibstats 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 16 files in this release have been uploaded with provenance metadata.
Attestation for pylibstats-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.