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

Running Iodide notebooks ONLY in browser - No Server #2551

Open
gregelin opened this issue Dec 15, 2019 · 8 comments
Open

Running Iodide notebooks ONLY in browser - No Server #2551

gregelin opened this issue Dec 15, 2019 · 8 comments

Comments

@gregelin
Copy link

Short summary of the bug. Please include the IODIDE version number where you found the bug - if you are just running locally (building for dev or prod) you can put MASTER

What I Did

I tried to run Iodide without a server -- just as a notebook. This would be very valuable, but it is unclear if it is possible or how to do it.

I tried to download the iodide HTML page on alpha.iodide.io and the related css and js files and the iframe file, but was was receiving an error stating "the target origin provided (‘https://alpha.iodide.io’) does not match the recipient window’s origin ('null')".

If Iodide is designed to run purely in the browser, it would be helpful to have a reference implementation where only static files are loaded from the local file system, or a clearer explanation of the configuration to run in the browser.

I would like to use Python in an environment where I cannot install ANY executable on the workstation -- no Docker, no Python, no Node, no Web server.

code sample or exact steps that causes the bug

What I Expected

explanation, imgs, etc.

What Happened

explanation, imgs. etc.

(if applicable) notebook that reproduces bug

link to the notebook that reproduces the bug. the smaller the better. you may wish to use https://definitely-staging.iodide.io/ (our staging environment, deploys from master) for creating/sharing the notebook.

@wlach
Copy link
Contributor

wlach commented Dec 16, 2019

This is actually the way Iodide used to work (each notebook was a self-contained bundle of html + js), but we found that a backend server is pretty much essential for being able to share your work with others.

We have discussed being able to export a copy of a notebook stored on a server elsewhere (#2178) but that seems a little different from what you're describing.

Can you give more detail on your use case here? Is there a reason you can't use a server hosted on the Internet, like iodide.io?

@gregelin
Copy link
Author

@wlach I've been away.

I am precisely looking to run Iodide as note book with self-contained bundle of HTML and JS without a backend server.

I do work for civilian federal government agencies (and previously worked in as federal government employee). The computers of government employees and contractors are very, very tightly controlled. Individuals cannot simply install Python, or Python packages. Nor is it is possible to install and run a web server (b/c that would involve installing Python or other software. There are very significant bureaucratic hurdles.

However, it is not so much of problem to work with Javascript files or CSS files provided those files are running in the BROWSER. (Since it is not possible to install Node.)

Sharing a zip file with self-contained bundle of HTML and JS is much easier to share in the government environment than sharing a back-end server of Python package.

@njss
Copy link

njss commented Sep 22, 2020

In my case:

I want to develop a web application for the Medical University and take advantage of using javascript and Python in the same app.
How can we integrate Iodide notebooks in our own javascript web app?

@pmp-p
Copy link

pmp-p commented Sep 26, 2020

There are multiple use cases that can be solved with appropriate packaging ( ordered from easy to hard) :

  • running everything from file:///
  • running python from a static page served via a webserver + code on maybe on a pastbin
  • running python from file:/// but getting code from a remote server

@gzuidhof
Copy link

gzuidhof commented Oct 2, 2020

@gregelin This is a pretty old issue by now, but I'm building something similar to Iodide that can be used standalone and it now supports Python as well. It's called Starboard, it's also open source. Maybe it's a good fit for your usecase.

Here's an example Python notebook, you can embed these on your own page as it's entirely static, here's the embed link (try view source).

There's no "export as zip" button, but it should be easy to set it up.

@pmp-p
Copy link

pmp-p commented Oct 2, 2020

There's no "export as zip" button, but it should be easy to set it up.

@gzuidhof , i'm confused as i'm not sure you are really solving a pyodide packaging problem here.

It's seems to me @gregelin wants a solution that will pack all pyodide ressources ( data / wasm / python / js ) in one single .html file with no extra dependency at all ( a bit like https://demo.blueroses.fr/wasipy.html or pyodide sized https://pmp-p.github.io/python3.html )

@gzuidhof
Copy link

gzuidhof commented Oct 2, 2020

I mean.. a single HTML file is possible as well, but that would be pretty large and wasteful (unless you only include those packages you actually use).

From what I understood the goal is to have a static bundle (not necessarily one html file, but it can be multiple files). Iodide requires a server to talk to, Starboard doesn't.

In other words: you could have a zip with files that you can serve locally and it should just work. Or you can open it with the browser without a server (haven't tried that though).

@gzuidhof
Copy link

gzuidhof commented Oct 2, 2020

Alright I just gave it a shot without any web server. The notebook seems to work fine, but loading external files doesn't work (=required for Pyodide). The issue is in CORS not being allowed on local files (for good reason!). So one would need to load the pyodide .asm.data files another way..

You could do this by putting their values in a <script src=> tag (which can still be added dynamically as required), it's a bit of a hack though... I would hope that internally, even in government organizations, there is some way to serve static files (it doesn't have to be localhost).

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

5 participants