How to start move my project to mojo?
I have a big project that I have worked on for years. Written in python. I do wish to reduce its runtime but rewrite the whole thing is an impossible option for me.
I wonder if it is possible to run the whole project through mojo instead out of the box (with some modifications to make it run)
And when i find time I'll modify some classes once in a while
Im using python 3.11 with numpy and numba (also a lot more but just to let you know)
I looked out for this question and couldn't find an answer for that.
Thank you!
4 Replies
So you can call Python from Mojo, but I don't think you can call Mojo from Python currently.
You'd need to write the core loop in Mojo just to be able to add Mojo functions to your project. Other than that, I don't think you gain anything from calling Python functions in Mojo.
https://docs.modular.com/mojo/manual/python/
Python integration | Modular
Using Python and Mojo together.
so its like bottom up? start from my entry point and brick by brick refactor the code to mojo?
Mojo can use any Python libraries, so I would split your project into modules as Python libraries, then see what modules take most execution time and re-write them in mojo. You can basically use any language for that but with Mojo you will be able to use any libraries that your project modules already use, so that won't be painful, syntax is also quite similar
Thank you that what ill start the first moment i can!
im start reading this book:
https://ruhati.net/mojo/index.html
any other suggestion maybe?
Mojo By Example: A Comprehensive Introduction to the Mojo Programmi...
A book on Mojo programming language, covering from the basics of the Mojo programming language to advanced topics.