Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for automatically bundling and byte compiling enaml file #24

Open
MatthieuDartiailh opened this issue Jun 6, 2017 · 5 comments

Comments

@MatthieuDartiailh
Copy link
Owner

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.

@tillbey
Copy link

tillbey commented Jun 7, 2017

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

@MatthieuDartiailh
Copy link
Owner Author

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
Copy link
Owner Author

@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
Copy link
Owner Author

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

@MatthieuDartiailh
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants