enaml icon indicating copy to clipboard operation
enaml copied to clipboard

Add support for automatically bundling and byte compiling enaml file

Open MatthieuDartiailh opened this issue 8 years ago • 5 comments

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.

MatthieuDartiailh avatar Jun 06 '17 18:06 MatthieuDartiailh

You mean so there's no need anymore for explicitly stating enaml files as data packages in setup.py? Then indeed I agree.

tillbey avatar Jun 07 '17 08:06 tillbey

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.

MatthieuDartiailh avatar Jun 07 '17 11:06 MatthieuDartiailh

@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.

MatthieuDartiailh avatar Jun 14 '17 14:06 MatthieuDartiailh

I took some time to start working on that see #28, I will let you know when this is ready to test.

MatthieuDartiailh avatar Jun 16 '17 12:06 MatthieuDartiailh

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.

MatthieuDartiailh avatar Jul 01 '17 14:07 MatthieuDartiailh