r/ScientificComputing • • 2d ago

I wrote a scientific computing library with zero runtime dependencies, and I keep the slow benchmark in the repo

Repo: https://github.com/Furox-Art/scientific-computing-system

What it is: a pure-Python scientific computing library with zero runtime dependencies. Import name cds, distribution scientific-computing-system, MIT, Python 3.11 and newer, current release 2.2.23.

Why I wrote it: NumPy and SciPy are excellent, and they are also twenty years of accumulated design decisions. Meanwhile a lot of scientific code ends up as a notebook that nobody can run six months later. This is what the same library looks like if it starts today with no C extensions and no Fortran: algorithms you can read, diff and audit instead of calls into a compiled extension.

What is inside, 34 subpackages: linear algebra and math utilities; ODE and PDE solvers; numerical integration and quadrature; interpolation; optimization; probability and statistics; Monte Carlo; uncertainty propagation and sensitivity analysis; Bayesian helpers; information theory; signal processing; wavelets; graph algorithms; machine learning helpers; genetics; fractals; NLP; quantum simulation; causal, modeling and workflow layers; units and dimensional analysis; validation; provenance.

CLI: a cds command with 13 subcommands (info, modules, constants, calc, stats, sample, integrate, hypothesis, benchmark, plot, dashboard and so on). examples/ holds 35 runnable scripts and notebooks.

Reproducibility, which is the part I care about most: every run can write a manifest with its inputs, seeds, versions and hashes, so a result can be re-checked later instead of guessed at. That is the provenance and workflow layers, and any of the 34 sub-packages can emit into it.

Install: pip install scientific-computing-system

The core needs nothing but the standard library. Extras are opt-in: [scientific] pulls NumPy, SciPy, statsmodels, scikit-learn, SymPy and Z3; [io] adds HDF5 and NetCDF; [plot] adds matplotlib; [pandas] adds a DataFrame bridge; [dashboard] adds Streamlit. There is also an npm entry, but it is only a launcher shim around python -m cds.

Tests: 161 test modules under tests/, run in CI, with coverage reported on codecov.

The honest limitation, since it is the first comment every time: pure Python is slow on dense numerics. The committed benchmark artifact records 100x100 matrix multiplication at 0.0696 s against NumPy's 0.000060 s, about 1155x slower. That artifact is a single CI run whose platform, CPU and library versions were not recorded, so treat it as order of magnitude only.

So do not reach for this for heavy matrix work. Reach for it when the dependency is the problem rather than the speed: locked-down or air-gapped machines, single-file scripts you want to read end to end, teaching an algorithm without stepping through C, and runs that need to carry their own manifest. If you want this API at compiled speed, scientific-computing-system-2.0 is the NumPy build of the same project.

0 Upvotes

5 comments sorted by

2

u/AgitatedTumbleweed65 2d ago

Pure python is too slow for scientific computing/ml.

Who is this library for?

1

u/Emergency-Tutor-7 2d ago

You're right that it is slow, and it is not for that. It exists for the cases where the dependency is the problem rather than the speed: air-gapped or locked-down machines where pip cannot pull wheels, single-file scripts you want to read end to end, tracing an algorithm without stepping through C, and runs that need to carry a manifest with inputs, seeds, versions and hashes.

The committed benchmark is blunt about the gap: 100x100 matrix multiplication at 0.0696 s against NumPy's 0.000060 s, about 1155x slower, from one CI run whose platform was not recorded. For dense numerics the answer is NumPy or SciPy. scientific-computing-system-2.0 is the same API on those backends if you want the interface without the penalty.

2

u/AgitatedTumbleweed65 2d ago

Ok, I read the end of the post... 🫠

1

u/AgitatedTumbleweed65 2d ago

Also, since you are doing this. Why not use python 3.13 onwards with no gil build? Would be interesting to see/test if some fancy multi threading can bridge the 1000x difference.

2

u/Inevitable_Exam_2177 2d ago

Your post sounds written with AI so I suspect your code is too