rustfrc
rustfrc is a Python package with some fast Rust functions that are useful when performing Fourier Ring Correlation (FRC) computations for resolution determination in microscopy (specifically optical nanoscopy). It was originally developed for use in a Bachelor end project for the TU Delft in the period 2021-2022. See the Python package frc for examples of its usage. The test_split.py file in the tests directory also holds some examples.
Since rustfrc contains compiled (Rust) extensions and is not pure Python, it is not available for all platforms, but only for those with available compiled wheels or a Rust toolchain and maturin support (see below). They are available for Windows (x86_64), macOS (universal2, which runs on both Apple Silicon and Intel) and Linux (x86_64, glibc 2.28 and later), for CPython 3.9 and later and for free-threaded CPython 3.15t and later. However, since Rust and Python are supported on many platforms, it is not difficult to compile for other platforms (see below).
Features
rustfrc has only a few features. The primary one is binom_split(x: ndarray) -> ndarray which samples binomial (n, 0.5) with n as the array element value. The operation is fully parallelized and somewhere between 3-10x faster than sampling using NumPy.
Furthermore, there are also (since version 1.1) sqr_abs(a: ndarray) -> ndarray and pois_gen(lam: float, shape: tuple[int, ...]) -> ndarray.
sqr_abs computes the element-wise norm and square of a complex array, while pois_gen generates an array of the specified size using the Poisson distribution and a single parameter λ.
Requirements
- Python 3.9 or later, or free-threaded Python 3.15t or later
- NumPy 1.19.3+ (newer Python versions need newer NumPy, e.g. Python 3.13 requires NumPy 2.1+)
Performance
On an i7-8750H, a decently high performance 6-core chip from 2017, I measured the following speeds:
binom_split: ~210 ms on a 4000x4000 array, with each element Poisson-generated with a mean of 200pois_gen: ~420 ms to generate a 4000x4000 array with mean 200sqr_abs: ~40 ms on a 4000x4000 array, where each element is a complex number with both the real and imaginary parts having a mean of 200
Take this with a grain of salt, but it should provide a decent order of magnitude for larger images.
Installation
You can most easily install rustfrc as follows:
pip install rustfrc
In a project managed by uv, add it with uv add rustfrc.
On a platform without a wheel, pip builds rustfrc from the sdist, which needs a Rust toolchain.
From source (using maturin)
rustfrc uses uv as its Python project manager and maturin as its build backend. Build a wheel file from the project directory like this:
uvx maturin build --release
This builds one wheel for CPython 3.9 and later. To build the wheel for free-threaded Python, build with a free-threaded interpreter, e.g. uvx maturin build --release -i python3.15t.
This generates .whl files in /target/wheels. Then, create a Python environment of your choosing (with numpy>=1.19.3 and python>=3.9), drop the .whl file in it and run pip install <.whl filename>, for example: pip install rustfrc-1.2.0-cp39-abi3-win_amd64.whl. Then, use import rustfrc in your Python script to be able to use the Rust functions. This should be generally valid for all platforms. The only real requirement is the availability of a Rust toolchain and Python for your platform.
Take a look at PyO3 for other installation options as the only true requirement for building is using a tool that understands PyO3 bindings, as those are used in the Rust code.
Manylinux
If you want to build .whl files that are compatible with a wide range of Linux distributions and can be uploaded to PyPI, take a look at .github/workflows/wheels.yml, which builds them with pyo3/maturin-action.
Development
uv
First, install uv and a Rust toolchain. Then run uv sync in the project directory. This creates a virtual environment in .venv, installs the (development) dependencies and builds the Rust extension with maturin. To develop against the oldest supported Python, pass it explicitly, e.g. uv sync -p 3.9.
After changing the Rust code, run uv sync again to rebuild the extension.
Run the Rust tests using cargo test and the Python tests using uv run pytest.
Note that type information is not available for the Rust functions, you will have to look at the Rust source code. Maturin builds a package structures as follows:
- root
rustfrcpackage_internal: this includesbinom_split_py, etc.split: this is the Python source code inpython/rustfrc/split.py
Releasing
Releases go through touchgate:
- Start the
touchgateworkflow with the version, and merge the pull request that it opens. - On the same day or the next, run
touchgate approvein a checkout of rustfrc. It signs an approval of the tip ofmainwith the security key, and startsrelease.ymlwith it.
If a release fails, fix the cause on main and run both steps again with the same version.
Every pull request adds a line under ## Unreleased in CHANGELOG.md. release.yml publishes only from the publish branch, with the wheels that wheels.yml builds. A change to either file goes on main, and the repository owner copies it to publish.
Metadata
Release files for rustfrc 1.2.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 |
|---|---|---|---|---|
| rustfrc-1.2.0.tar.gz | 58.2 kB | With provenance | Details for rustfrc-1.2.0.tar.gz |
Built distributions (wheels)
Total release size: 2.9 MB
Release files / rustfrc-1.2.0.tar.gz
| Download URL | rustfrc-1.2.0.tar.gz |
|---|---|
| Size | 58.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e960c955f0b5a695faea89d1a734aef399f55174c495bcd88a2988ba22e6242
|
|
BLAKE2b-256 checksum How to use checksums |
f18d2805157c209ac7be18e0ff9a1d59787da05094ee1995c6cda871b363f34a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp315-abi3.abi3t-win_amd64.whl
| Download URL | rustfrc-1.2.0-cp315-abi3.abi3t-win_amd64.whl |
|---|---|
| Size | 245.5 kB |
| Tags | CPython 3.15 Windows x86-64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
6db7d180f89d4493ccd1626ddaf2f7e3b1c50eb14a9e224d23ab93f7705d80c1
|
|
BLAKE2b-256 checksum How to use checksums |
b876b3fea09ef9ece72f20dd21419c0bc64c3992a1424b6f7412cab3976b35f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
| Download URL | rustfrc-1.2.0-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 422.4 kB |
| Tags | CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
858569062f6ba7f1d6f20cc40b08aaf46469144dc291154032cb681adf61c57b
|
|
BLAKE2b-256 checksum How to use checksums |
17df32445f8c99e83873d72247f4a10642671cbdd49bdc762b4da7a0ba3b9b01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp315-abi3.abi3t-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
| Download URL | rustfrc-1.2.0-cp315-abi3.abi3t-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
|---|---|
| Size | 713.4 kB |
| Tags | CPython 3.15 abi3 abi3t macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4e65a54bb9ed5c0161a16c179e027559fcd3c3d9fc90d68aeda501a22970b772
|
|
BLAKE2b-256 checksum How to use checksums |
b22e277a2b1dfd8146f0b15e5e417aeaa3ee20cadaeefefeb83c840776d5f613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp39-abi3-win_amd64.whl
| Download URL | rustfrc-1.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 254.7 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cbc5c631ba55437f38a19f658c626eeb5eac8c53415aba9757a3ef25241efe57
|
|
BLAKE2b-256 checksum How to use checksums |
eae6bdbc4d8276d383212b06247479914e9abbc4391e9ac24a5de26166b55168
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | rustfrc-1.2.0-cp39-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 429.9 kB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
03bde69728e20edd2147792b611080c3db5191c259622485223d73cf7e9607fa
|
|
BLAKE2b-256 checksum How to use checksums |
b0edfc2783a4f2b1146c194a5e81a39b9a60d3ffdce924c8c2e28c5e904948c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logRelease files / rustfrc-1.2.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
| Download URL | rustfrc-1.2.0-cp39-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
|---|---|
| Size | 735.2 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1f3756e4dda3fdd9aadb15f164da44f1330a7dae8ab39534c778914754a01e66
|
|
BLAKE2b-256 checksum How to use checksums |
3fa0856f8e80fad65067155b6b5871906a9fe67229bd0c449b4e4c73609d5788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
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 Nov 1, 2026.
Transparency logSecurity for rustfrc 1.2.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 7 files in this release have been uploaded with provenance metadata.
Attestation for rustfrc-1.2.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 Nov 1, 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.