sympy-rust
Rust port of the sympy/sympy
polys-domain kernel: dense polynomial arithmetic over QQ plus the QQ
domain operations. See NOTICE for upstream attribution.
Scope
Kernel-scoped, not a mirror bid. SymPy is 497K LOC of pure Python; the rustsmith headroom probe graded the two candidate kernels:
| kernel | score | verdict |
|---|---|---|
polys-domains (dup_mul + pythonmpq QQ ops) |
0.85 | rewrite |
| simplify-core (9-module dispatch) | 0.49 | upstream_only — out of scope |
Port seam: dup_mul/dup_add/dup_sub/dup_gcd (univariate dense over
QQ) + recursive dmp_mul (multivariate) + QQ exact rationals. GCD
output is monic (unit-normalized, as upstream). Expand only with measured
wins.
Layout
sympy-poly-core/— reusable Rust core, no Python dependency.src/lib.rs— thin PyO3 binding (sympy_poly._core).sympy_poly/— Python converters (Poly↔ dense lists).tests/test_equivalence.py— exact-equality corpus vs sympy.bench/— two-track wall + peak-RSS benches, measured-only.
Install
Published as sympy-poly-rust (version 0.1.0). The 0.1.0 files land on
TestPyPI first (same wheel + sdist, same SHA-256) and are promoted to PyPI;
until the production landing completes, install from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ sympy-poly-rust==0.1.0
pip install sympy-poly-rust==0.1.0 # PyPI, once promoted
The Rust core is on crates.io as sympy-poly-core 0.1.0
(cargo add sympy-poly-core).
The Python layer converts coefficients with sympy.QQ, so sympy is a
runtime dependency of the installed package.
From source
pip install maturin
maturin develop # inside a virtualenv
pytest tests/
python bench/bench_poly.py
Status
Kernel slice v0.1.0, measured on x86_64 / python 3.12.3 / sympy 1.14.0
(bench/results.json; wall = best-of-3, maxrss = process peak):
| workload | sympy wall (s) | rust wall (s) | speedup | sympy RSS (MB) | rust RSS (MB) |
|---|---|---|---|---|---|
| dup_mul_800 (univariate deg-800 dense QQ) | 0.212 | 0.042 | 5.06x | 46.3 | 46.9 |
dmp_mul_3var ((x+y+z+1)^12 squared) |
0.112 | 0.013 | 8.75x | 48.6 | 48.9 |
| dup_gcd_70 (heuristic-friendly shape) | 0.001 | 0.008 | 0.17x, slower | 49.0 | 48.9 |
Accuracy: tests/test_equivalence.py 9/9 exact vs sympy; core unit
tests 14/14 (cargo test -p sympy-poly-core); upstream kernel subset
(test_densearith + test_densetools + test_euclidtools) 105 passed
on origin as baseline.
Ranked follow-ups: heuristic (evaluation/interpolation) GCD for
heuristic-friendly shapes — the PRS here is correct but ties-or-loses
where sympy's heuristic fires; multivariate GCD; factor stays upstream.
Release
0.1.0 ships the sympy-poly-rust Python distribution (wheel + sdist)
and the sympy-poly-core Rust crate. Release scope, artifacts, and the
verification battery are recorded in specs/release.md; the lane config is
release.toml; upstream attribution is NOTICE.
Metadata
Release files for sympy-poly-rust 0.1.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 | |
|---|---|---|---|---|
| sympy_poly_rust-0.1.0.tar.gz | 20.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sympy_poly_rust-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 360.8 kB
Release files / sympy_poly_rust-0.1.0.tar.gz
| Download URL | sympy_poly_rust-0.1.0.tar.gz |
|---|---|
| Size | 20.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
447cbfe08b3d76eb0801fc4969d5cf38150dacf7191979150b86f6be18c0400b
|
|
BLAKE2b-256 checksum How to use checksums |
13dbdc6ddfeed2cc84aa0ad614977026924765f4d9454647e3fbc9e8cf422034
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / sympy_poly_rust-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | sympy_poly_rust-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 340.0 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee03d95f425c930c80c4806d99188cf1132959348bf4942eec7e03e0ecf8b9a2
|
|
BLAKE2b-256 checksum How to use checksums |
3c53ceae1d95fc2eeccd0d05b97dbce6259c27fde9bfd49bded088390a9ac074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for sympy-poly-rust 0.1.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.