Hello!
My friend and I are working on our pet project, a website for hosting algorithms that test sociological hypotheses and accumulate knowledge on sociology. We envision our site to be similar to Wikipedia with one exception: we want to present all the articles on the site in the form of Jupyter Notebooks. Our site engine is based on Django.
Could you please tell me what is the best / easiest way to add the Jupyter Notebook editor to a 3rd party website?
We understand that Jyputer runs on Tornado, that it is single-user, and we need to write a lot of the server logic. Our current understanding is to use the Jyputer Client to work with IPython, take the UI from Jupyter Lab, and write the server handlers ourselves. Could you please tell me if this is the right approach? What should we keep in mind? Is there an easier way to achieve our goal (for example, base our work on Jupyter Server instead of Jupyter Client)?
We would like to focus on developing our site and keep compatibility with Jupyter as much as possible so that we can update / commit a change to the Jupyter project if it is needed.
I would appreciate any advice!
For the front end, you could start from the JupyterLab notebook example: https://github.com/jupyterlab/jupyterlab/tree/master/examples/notebook
1 Like
Thank you for the advice. Looking at it!
take the UI from Jupyter Lab, and write the server handlers ourselves. Could you please tell me if this is the right approach?
That’s an interesting approach but you will have to copy over a lot of handlers from Jupyter and it’ll be hard to keep in-sync with changes on Jupyter server side. Plus contributing back to Jupyter would also be a bit manual (assuming your file structure wouldn’t directly map to Jupyter codebase).
How about this -
When users are authoring content on your site, you simply spin up a complete Jupyter instance for them to write notebooks. Only change the backend (ContentManager interface I believe) to store the content somewhere you like (e.g. S3) instead of writing to local disk.
When users are reading content you simply fetch the notebook from S3 and apply nbconvert to convert it to HTML for rendering.
One thing to keep in mind - When exposing Jupyter interface for writing content, you are exposing underlying compute as users can execute arbitrary code. You’d want to design the offering to avoid abuse. Spinning up an isolated pod instance with limited memory/compute resources is probably a good idea.
1 Like