NHacker Next
login
▲Translating Cython to Mojo, a first attemptfnands.com
60 points by fnands 10 hours ago | 7 comments
Loading comments...
hyperbovine 4 hours 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.
westurner 2 hours ago [-]
/? 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#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 
]
almostgotcaught 3 hours ago [-]
> Last I checked it still needed setup.py which is a bit of a deal breaker in 2025.

lolwut

RossBencina 3 hours ago [-]
Very interesting. I'm currently trading off whether to use Mojo or C++/pybind to accelerate simulations that combine matrix operations with fine-grained scalar calculations. I only recently learned that pybind + cppimport offers the integrated compile-on-import experience available in Mojo.
adsharma 6 hours ago [-]
A more interesting path is to keep dbscan_inner in pure python with type annotations and then use

  py2many --mojo=1 dbscan_inner.py
to translate.
baobun 6 hours ago [-]
Somehow just trying to navigate to this website makes my browser crash.

Firefox on Android with NoScript.

VoidWhisperer 5 hours ago [-]
Something with Noscript is causing it. I was able to load it fine, then installed noscript and it suddenly crashed