Provide a optional pure-python mode like Cython does to ease code sharing?

I have my Python library maintainer hat here. It would be cool to support both Python and Mojo (with speedups from struct & other) within a single wheel on Pypi, but without having to provide a Python extensions (which are harder to distribute) and without duplicating all the code. Cython already solves this problem with pure-python mode. Maybe let's steal those ideas? I made a discussion about it on github but I didn't get much attention there: https://github.com/modularml/mojo/discussions/922 What do you think? Maybe it could be a metaprogramming third-party lib?
GitHub
[Feature request] Provide a optional pure-python mode like Cython d...
Hi all, I speak as a library maintainer who likes this new language a lot! I like the mentality of "Mojo meets developers where they are". And Python devs are making libraries and distrib...
4 Replies
Carti.
Carti.12mo ago
actually its better if you implement the whole project in Mojo from scratch if you really looking for speed up (im doing the same thing)
gabrieldemarmiesse
Very few projects can accept the cost of rewriting everything at once (for some open source projects that might take years), and while the maintainer is rewriting everything in mojo, he still have to support the existing python implementation with bugfixes and such... and then after the whole rewriting, maintaining two codebases is too much work. The work to make sure the two implementations have the same behavior is as big as the numbers of lines of code to cover. Starting from scratch is a luxury that only small or new libraries have.
Alex Kirchhoff
Alex Kirchhoff12mo ago
This is a great idea, but we are a long way off from the goal of being a superset. I think that this could make a lot of sense once Mojo gets there, though. There's a lot of churn in the mean time.
Darcy DeClute (@Scrumtuous!)
"Superset" seems like a dream.
Want results from more Discord servers?
Add your server