Open MatthieuDartiailh opened 7 years ago
You mean so there's no need anymore for explicitly stating enaml files as data packages in setup.py? Then indeed I agree.
Yes that would be the idea. And also byte-compiling them like any python file. In my other projects I can have large startup times or lag when compiling a file for the first time.
@tillbey would you be interested in looking into this ? I can give some pointers about where to start that should get you more than halfway I think.
I took some time to start working on that see #28, I will let you know when this is ready to test.
This has been addressed in #28 but does not play well with conda because contrary to the standard import machinery of Python (https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap_external.py#L492 and https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap_external.py#L778) enaml does not set the co_filename of the cached code object, which allow to ignore any issue with a reference to the build directory left in the file. Under Python 3 this can be done using _imp._fix_co_filename, under Python 2 it is not possible to set co_filename. It may be possible to workaround this by creating a new Code object using types, need to investigate.
Enaml could provide a patched setup automatically taking care of installing enaml files and byte-compiling them upon install. This would avoid duplicate work in project and long startup time for first application startup.