Skip to main content

RustyLab

Numerical Accuracy Testing PyPI version License: MIT

🚧 RustyLab is under active development and its functionality is subject to change.

RustyLab is a high-performance scientific computing and machine learning library for Python, with its numerical core written entirely in Rust.

It aims to unify the core functionality of SciPy, statsmodels, and scikit-learn into a single, cohesive Python library with a strong focus on speed, safety, and ergonomics.

RustyLab is built in Rust and exposed to Python using PyO3 and maturin, with a thin Python layer that offers the same routines as native Polars expressions - combining Rust's performance with Python's ease of use.


🚀 Why RustyLab?

The Python scientific ecosystem is powerful, but fragmented:

  • Numerical routines live in SciPy;
  • Statistical modelling in statsmodels;
  • Machine learning in scikit-learn;
  • Performance is built on a long-evolving foundation of native implementations and Python APIs.

RustyLab takes a different approach:

  • Rust numerical core - memory safe, fast, and modern (i.e., the Python layer only builds expressions);
  • Polars-native data model - designed for full compatibility with Polars;
  • Unified API - statistics, optimization, and ML under one roof;
  • Python bindings - no compromises in usability;
  • Performance by default - zero-cost abstractions and parallelism;
  • Safe & predictable - fewer runtime surprises.
  • Auditable source - all function implementations are readily accessible, with Wiki references pointing to the exact code locations.

📦 Quickstart

Install the latest release of RustyLab Python client using pip:

pip install rustylab

Once installed, you can import the RustyLab library, any of its modules, or individual functions:

>>> import rustylab                     # Import the full library
>>> rustylab.special.beta(0.5, 0.5)

>>> from rustylab import special        # Import a specific module
>>> special.beta(0.5, 0.5)

>>> from rustylab.special import beta   # Import a function directly
>>> beta(0.5, 0.5)

>>> import polars as pl                 # Use the same routines as Polars expressions
>>> from rustylab import expr
>>> pl.DataFrame({"x": [0.0, 1.0, 2.0]}).with_columns(
...     pdf = expr.stats.norm.pdf("x")
... )

📏 Numerical Accuracy

RustyLab is designed to deliver highly accurate and reproducible numerical results. In practice, this means that values produced by RustyLab agree with trusted reference implementations to approximately 13–15 significant decimal digits (≈ 99.999999999999% accuracy, where relative error is meaningful, or with a difference smaller or equal to 1e-15). This level of precision is consistent with the practical limits of double‑precision (f64) floating‑point arithmetic.

RustyLab functions are systematically benchmarked against a trusted Python alternative, such as mpmath, NumPy, SciPy, or equivalent reference implementations. This ensures that:

  • Numerical results closely match established Python scientific computing standards.
  • Edge cases, including near‑zero values, very large magnitudes, and numerically sensitive operations, are handled consistently.
  • Any deviations from reference implementations are intentional, well‑understood, and documented.

To validate this level of accuracy:

  • Outputs are tested via tolerance‑based comparisons using pytest.approx.
  • The tolerance‑based checks make use of the following strict thresholds:
    • Relative tolerance: 1e-12
    • Absolute tolerance: 1e-15

The tolerance‑based checks make use of both relative and absolute tolerances simultaneously, following the semantics of pytest.approx: a comparison passes if either the relative error or the absolute error is within the specified bounds. In practice, this means that values with a meaningful scale are validated to many significant digits via the relative tolerance, while near‑zero or scale‑free quantities are validated via a strict absolute error bound. In all cases, the tolerances are chosen to reflect the limits of double‑precision floating‑point arithmetic and to ensure numerically correct results.

By combining high‑precision testing, strict absolute and relative error bounds, and direct comparison against well‑known Python libraries, RustyLab provides transparent and verifiable numerical accuracy suitable for both general‑purpose computation and demanding scientific workloads.

📚 Documentation & Module Reference

RustyLab’s full API documentation is maintained in the project's Wiki, which includes:

  • A structured overview of all available modules.
  • Documentation strings for every public function.
  • Direct links to the corresponding Rust source files.
  • Usage examples.

Explore the documentation here:
👉 RustyLab Wiki — https://codeberg.org/esuriddick/rustylab/wiki

The Wiki is continuously updated as new features are added, making it the best place to understand the library’s capabilities.

Metadata

Release files for rustylab 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rustylab 0.3.0
File Size Uploaded Provenance Actions
rustylab-0.3.0.tar.gz 1.4 MB Without provenance Details for rustylab-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rustylab 0.3.0
File Interpreter ABI Platform Actions
rustylab-0.3.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for rustylab-0.3.0-cp310-abi3-win_amd64.whl
rustylab-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for rustylab-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rustylab-0.3.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for rustylab-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 17.5 MB

Release files / rustylab-0.3.0.tar.gz

Download URL rustylab-0.3.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
45a33eb05222e14e71c007f4afc0b6a6749011a0aa82073cc860ebebd7109173
BLAKE2b-256 checksum
How to use checksums
aa6cdf0def96e88482d26460c8794dd87ad136309f98bad03d6c1d043e6529a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / rustylab-0.3.0-cp310-abi3-win_amd64.whl

Download URL rustylab-0.3.0-cp310-abi3-win_amd64.whl
Size 6.0 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e0d498c15508e3226cc5878ec7aebef137ebc6dbf4e130235af4be32707a4a41
BLAKE2b-256 checksum
How to use checksums
0190297a85518b73e33a6f9b89a88ec6559fa62c84b4438ccbeab15ac9a2b8b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / rustylab-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rustylab-0.3.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
78a798870c382c3bc8570d020b6322668ca597a7d8fd270c7c4e6fe9208f339d
BLAKE2b-256 checksum
How to use checksums
1dceaaa87050a86060f76e951e2a0756ac56b132ac4a2e23673e068226c3f3de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / rustylab-0.3.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL rustylab-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
Size 4.7 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
80a1d64c05b62a25c28b96e9a93361d4bf91e409bcf187e6fdfaa6d1d28a7579
BLAKE2b-256 checksum
How to use checksums
55dc7479c93f0223dbb16d0cf1e7cc31f12238566a6be28c20ba2a1ae90d918f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for rustylab 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page