-
Notifications
You must be signed in to change notification settings - Fork 13
rearrange repo and add spin-python-cli
#8
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
Conversation
`spin-python-cli` is a stand-alone binary for converting a Python app to a Spin-compatible Wasm module. The intention is that we'll publish this as a `Spin` plugin, analogous to the JS/TS SDK's `js2wasm` utility. The implementation is a bit more complicated than `js2wasm` because the Python interpreter loads the core library, the app, and its dependencies from disk, so we have to: - Embed the core library in the binary and extract it to a temporary directory prior to pre-initializing with Wizer - Search for the `pipenv` `site-packages` directory and add it to `PYTHONPATH` - Set various environment variables so the Python interpreter knows where to find things (and not buffer stdio) - Set another environment variable so the pre-init function knows which module the app lives in Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
radu-matei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built from source and tested the sample application included here, everything seems to work great!
One question I have is around type hints, and whether that is something we would like to include.
LGTM!
|
By "type hints", I assume you mean Anyway, yes, that would be cool to add. |
|
Type hints are baked into the stdlib/language now. See the |
karthik2804
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great!
Signed-off-by: karthik2804 <karthik.ganeshram@fermyon.com>
spin-python-cliis a stand-alone binary for converting a Python app to a Spin-compatible Wasm module. The intention is that we'll publish this as aSpinplugin, analogous to the JS/TS SDK'sjs2wasmutility.The implementation is a bit more complicated than
js2wasmbecause the Python interpreter loads the core library, the app, and its dependencies from disk, so we have to:pipenvsite-packagesdirectory and add it toPYTHONPATHSigned-off-by: Joel Dice joel.dice@fermyon.com