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

Support ahead-of-time compilation #609

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

meredydd
Copy link
Contributor

@meredydd meredydd commented Jul 28, 2016

Adds two commands: compile (which compiles a single .py file to a .js file that's ready to load), and compileall (compiles a directory of mixed .py/.js files into a JS file that adds its contents to Sk.builtinFiles.files, like skulpt-stdlib.js does).

This PR also adds a default Sk.read() implementation that uses Sk.builtinFiles.files, so as long as you've included skulpt.js and skulpt-stdlib-js (plus any additional JS files you've generated with ./m compileall), module loading will work out-of-the-box.

This should help address complaints about how much of a pain it is to include extra Python modules in your Skulpt environment (eg issue #554, arguably #601, the underlying problem behind PR #606...)

@meredydd meredydd force-pushed the aot-compile-pr branch 2 times, most recently from 33a7b66 to 2e627af Compare July 28, 2016 14:48
@rixner
Copy link
Contributor

rixner commented Aug 2, 2016

Should there be some way to check if the compile time options (such as debugging, yieldLimit, etc.) are the same as the runtime options when you use these compiled files? And at least print some sort of warning? Otherwise, if you mix aot and run-time compiled code, you might get unexpected results. Or do you feel like this is a "use at your own risk" feature? (In which case, perhaps that should be made really clear...)

@rixner
Copy link
Contributor

rixner commented Aug 2, 2016

(I'm also not totally convinced that ahead-of-time compilation is the solution to the "pain" of including extra Python files. Arguably, that's a deficiency of the documentation. If you drop them in the lib folder, for instance, it "just works" - assuming, of course, that Skulpt supports the features that they are trying to use. Just an aside, not an argument against the pull request.)

@albertjan
Copy link
Member

It may be something people are looking for, it doesn't break anything in our default workflow does it?

@meredydd
Copy link
Contributor Author

meredydd commented Sep 2, 2016

@rixner - absolutely. Ahead-of-time compilation is not the solution to the pain of bundling extra python files - ./m combineall is.

(And it is a pain - right now the only way to add them to the build is to either copy them into the Skulpt source tree(!!), or roll your own Sk.builtin.read() implementation - which is what Anvil does, but it's a pain for new users.)

Should I separate out AOT compilation from combineall? I agree AOT has issues with build options. (Also, it creates really big .js files)

@s-cork s-cork marked this pull request as draft July 8, 2022 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants