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

Serving python application directly #481

Closed
phorward opened this issue Jul 2, 2019 · 2 comments
Closed

Serving python application directly #481

phorward opened this issue Jul 2, 2019 · 2 comments

Comments

@phorward
Copy link
Contributor

phorward commented Jul 2, 2019

Hi everyone!

I have an application written in pure Python, which is not packaged providing a setup.py or something similar. Especially for development purposes and due to custom modifications, the application cannot always be made available via a public URL at PyPI or somewhere else.
The best way - in my opinion - would be to store my current application sources in some kind of "file system" which is then served to pyodide can directly be imported, so it behaves like a Python interpreter I locally invoke and run a python script / package from my local file system.
Regarding to #417 and #469, loading one module from a location would be possible, but the application exists of several modules.

Is such a solution possible or do you have any other suggestions how this can be solved? Always compile and building packages using a local pyodide development environment is a bad option, especially for debugging and development.

During my recent research I was unable to find any useful information on how to resolve my use case, so please be patient with me that I post it as issue here.

Thanks for any tips and help!

@rth
Copy link
Member

rth commented Jul 8, 2019

The best way - in my opinion - would be to store my current application sources in some kind of "file system" which is then served to pyodide can directly be imported, so it behaves like a Python interpreter I locally invoke and run a python script / package from my local file system.

If pyodide worked in node.js you would be able to load packages from your file-system directly. There was work done to make it happen it happen in #183 (and there is a functioning implementation in https://github.com/gabrielfreire/pyodide-node, though with a somewhat outdated version now).

Otherwise, I think browser sandboxing won't allow you to interact with the filesystem, unless you are running an HTTP server on localhost.

Always compile and building packages using a local pyodide development environment is a bad option, especially for debugging and development.

There is WIP to avoid rebuilding packages needlessly in #466, that might help some.

@phorward
Copy link
Contributor Author

phorward commented Aug 6, 2019

I've created PR #489 and finished it now, it works perfectly for my needs!

@phorward phorward closed this as completed Aug 6, 2019
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