4 ms·
In my niche corner of scientific computing it feels like Cython has largely been replaced by Numba and CFFI, or just Julia. Last I checked it still needed setup
by hyperbovine 1y ago
In my niche corner of scientific computing it feels like Cython has largely been replaced by Numba and CFFI, or just Julia. Last I checked it still needed setup.py which is a bit of a deal breaker in 2025.
- almostgotcaught 1y ago> Last I checked it still needed setup.py which is a bit of a deal breaker in 2025. lolwut
- westurner 1y ago/? cython pyproject.toml: https://www.google.com/search?q=cython+pyproject.toml https://www.google.com/search?q=cython+pyproject.toml From "Building cython extensions using only pyproject.toml (no setup.py)" https://github.com/pypa/setuptools/discussions/4154#discussioncomment-12424894 https://github.com/pypa/setuptools/discussions/4154#discussi... : [build-system] requires = ["setuptools", "cython"] [tool.setuptools] ext-modules = [ {name = "example", sources = ["example.pyx"]} # You can also specify all the usual options like language or include_dirs ]
- physicsguy 1y agoPybind11 seems more popular in my area now. I still like Cython though in terms of the ease of wrapping anything in a Python-y interface.
- maleldil 1y agoObligatory Rust + PyO3/Maturin plug. Very ergonomic and easy to use.
- physicsguy 1y agoThat's true but I still don't see that so much because the core libraries are not as mature and often they're just thin wrappers around the C/C++/Fortran API without examples. Just as an example, I'd count this SUNDAILS library as like that: https://docs.rs/sundials/0.3.2/sundials/ https://docs.rs/sundials/0.3.2/sundials/ Nothing wrong with that as a starting point of course, but it's easier just to compile it as a dependency and look at the core documentation if you're familiar with C++; you'll need to be reading the C++ examples anyway to write Rust code with it.
- pjmlp 1y agoAnd it will get even better with reflection, there are already a few talks on the matter, generating Python bindings with C++26 reflection.
- maleldil 1y agoSorry, I can't find a relationship between Sundials and PyO3/Maturin. Am I missing something?
- physicsguy 1y agoWhat I mean is that (at least in my experience) people are not so commonly writing serious numeric applications in Rust as Python extensions because the numeric libraries on which you'd typically write in a compiled language are not as well developed and are in themselves often thin wrappers over C/C++ code at the moment. When you write an extension library you typically want all the 'slow' stuff to be done in a layer below the interpreted language for performance reasons. So if you wanted to write a Python Physics library that included, say, time integration with an implicit solver like those SUNDIALS provides (and SUNDIALS is like the gold standard in this area), you have less well used options for the time integration part if you write the extension in Rust as if you do in C/C++. Or you're using the same library anyway.
- westurner 1y agoIt looks like Narwhals; "Narwhals and scikit-Lego came together to achieve dataframe-agnosticism" https://news.ycombinator.com/item?id=40950813 https://news.ycombinator.com/item?id=40950813 : > Narwhals: https://narwhals-dev.github.io/narwhals/ https://narwhals-dev.github.io/narwhals/ : >> Extremely lightweight compatibility layer between [pandas, Polars, cuDF, Modin] > Lancedb/lance works with [Pandas, DuckDB, Polars, Pyarrow,]; https://github.com/lancedb/lance https://github.com/lancedb/lance SymPy has Solvers for ODEs and PDEs and other libraries do convex optimization. SymPy also has lambdify to compile from a relatively slow symbolic expression tree to faster 'vectorized' functions From https://news.ycombinator.com/item?id=40683777 https://news.ycombinator.com/item?id=40683777 re: warp : > sympy.utilities.lambdify.lambdify() https://github.com/sympy/sympy/blob/master/sympy/utilities/lambdify.py#L182 https://github.com/sympy/sympy/blob/master/sympy/utilities/l... : >>> """Convert a SymPy expression into a function that allows for fast numeric evaluation""" [with e.g. the CPython math module, mpmath, NumPy, SciPy, CuPy, JAX, TensorFlow, PyTorch (*), SymPy, numexpr, but not yet cmath]
- yosefk 1y agoextern "C" functions + ctypes are a personal favorite - it's the least "type-rich" approach by far, and I prefer poverty to this sort of riches
- hyperbovine 1y agoThanks, but experimental support based off a Github comment is not what I'm looking for when I distribute software.
- westurner 1y agoPersons who need pyproject.toml functionality could consider contributing tests so that the free functionality might be considered adequate for their purposes.
- Certhas 1y agoI haven't kept track of numba in recent years. But there is a clear path to translate more and more scikit-learn to mojo, bypassing the python interpreter entirely. And then things become much more composable in a way that numba can't be. We are heavily leaning on Julia, and to my mind Mojo is a major threat to the long term development of the Julia community. If people dissatisfied with Python+C(++)-Silos end up writing Mojo instead of Julia it will become even harder to grow the ecosystem and community. That said, for now Julia has a number of big strengths for scientific work that don't seem to be in the focus of the Mojo devs...
- fnands 1y agoYeah, I went to JuliaCon last year, and it was clear that Julia really seems to have found it's niche in the scientific computing world. I like the language, but as I do ML, Python is really the only game in town, and Mojo is looking promising.
- Archit3ch 1y ago> Mojo is a major threat to the long term development of the Julia community Mojo has 3 disadvantages compared to Julia: 1) The core team is focused on the Linux+servers+AI combination, because that's where the money is. 2) Less composability due to the lack of multiple dispatch. 3) The license.