Skip to main content

RustyLab is a high‑performance scientific computing and machine learning library for Python, powered by a pure Rust core and exposed through PyO3.

Project description

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, 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, 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:

  • Pure Rust core - memory safe, fast, and modern;
  • 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)

📏 Numerical Accuracy

RustyLab is designed to deliver highly accurate and reproducible numerical results. In practice, this means that values produced by RustyLab typically 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.

To validate this level of accuracy:

  • Outputs are tested using a combination of exact equality checks (where results are mathematically and numerically identical) and tolerance‑based comparisons using pytest.approx.
  • When tolerance‑based checks are applied, the following strict thresholds are used:
    • Relative tolerance (rel): 1e-12
    • Absolute tolerance (abs): 1e-15

When tolerance‑based checks are used, both relative and absolute tolerances are applied 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.

In addition, every RustyLab function is systematically benchmarked against a trusted Python alternative (such as 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.

By combining high‑precision testing, exact checks where appropriate, 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 Wikihttps://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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustylab-0.2.0-cp310-abi3-win_amd64.whl (213.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

rustylab-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (312.1 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

rustylab-0.2.0-cp310-abi3-macosx_11_0_arm64.whl (272.6 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file rustylab-0.2.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: rustylab-0.2.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 213.5 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using 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}

File hashes

Hashes for rustylab-0.2.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8bf6b3386877c746175cbe9a063ddc8b41d618887dca085a9bd839f832a0280f
MD5 0d1ff4c5cefd530c47552598646a74f9
BLAKE2b-256 8915b9302584eb68b74c6a2889dd1b8e503d77a66eefc1b84033c2956d7f7814

See more details on using hashes here.

File details

Details for the file rustylab-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: rustylab-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 312.1 kB
  • Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
  • Uploaded using 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}

File hashes

Hashes for rustylab-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 81cd3404cac74b2c2d75325e3c34af3789f6daee9352d5949cc16df284a6c629
MD5 3a4f0d65c226198e1f0d3526c304646a
BLAKE2b-256 f97cf13347ceb1ccbd96f20c02366d3594a20d92237f79720b09499da9155698

See more details on using hashes here.

File details

Details for the file rustylab-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: rustylab-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 272.6 kB
  • Tags: CPython 3.10+, macOS 11.0+ ARM64
  • Uploaded using 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}

File hashes

Hashes for rustylab-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f631accee205fc5b25aeab9f7327a14492b0f5e052397e41ec0a462fc9ad234d
MD5 d6c29e2b110909f4a26a41e7e5e51407
BLAKE2b-256 398f15bbe91059af4e46237ba7421754cb988fe014efcf20f867d7cdb0c9b567

See more details on using hashes here.

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