Since mypyc compiles modules, it probably needs to be run on all src/*.py files. Doing only mypyc main.py probably only compiles the entrypoint.
E.G.:
- If you delete one of the files like
src/cpu.py, mypyc still compiles successfully but ModuleNotFoundErrors at run time. This presumably shows it's still trying to import the slow, uncompiled cpu.py.
- Looks like you can open
build/__native.c to read the generated code. It's not pretty, but it doesn't look like it's doing anything more than importing the uncompiled modules, running them, and exiting.
- Docs show separately specifying all modules that you want to compile.
No idea if it will even work if you try to compile everything— E.G. To get it running in Cython, I had to separate all the exec()-generated code in cpu.py out into actual code instead (....Which I see has been removed and made obsolete literally the day after I did that.... Gosh dangit!)— If that's needed for MyPy too, I can post that as a starting point.
Since
mypyccompiles modules, it probably needs to be run on allsrc/*.pyfiles. Doing onlymypyc main.pyprobably only compiles the entrypoint.E.G.:
src/cpu.py,mypycstill compiles successfully butModuleNotFoundErrors at run time. This presumably shows it's still trying to import the slow, uncompiledcpu.py.build/__native.cto read the generated code. It's not pretty, but it doesn't look like it's doing anything more than importing the uncompiled modules, running them, and exiting.No idea if it will even work if you try to compile everything— E.G. To get it running in Cython, I had to separate all the
exec()-generated code incpu.pyout into actual code instead (....Which I see has been removed and made obsolete literally the day after I did that.... Gosh dangit!)—If that's needed for MyPy too, I can post that as a starting point.