Question or problem about Python programming:
I am trying to wrap my head around what I can/cannot do with Jupyter.
I have a Jupyter server running on our internal server, accessible via VPN and password protected.
I am the only one actually creating notebooks but I would like to make some notebooks visible to other team members in a read-only way. Ideally I could just share a URL with them that they would bookmark for when they want to see the notebook with refreshed data.
I saw export options but cannot find any mention of “publishing” or “making public” local live notebooks. Is this impossible? Is it maybe just a wrong way to think about how Jupyter should be used?
How to solve the problem:
The “best” way to share a Jupyter notebook is to simply to place it on GitHub (and view it directly) or some other public link and use the Jupyter Notebook Viewer. When privacy is more of an issue then there are alternatives but it’s certainly more complex; there’s no built-in way to do this in Jupyter alone, but a couple of options are:
Host your own nbviewer
GitHub and the Jupyter Notebook Veiwer both use the same tool to render
.ipynb files into static HTML, this tool is nbviewer.
The installation instructions are more complex than I’m willing to go into here but if your company/team has a shared server that doesn’t require password access then you could host the nbviewer on that server and direct it to load from your credentialed server. This will probably require some more advanced configuration than you’re going to find in the docs.
Set up a deployment script
If you don’t necessarily need live updating HTML then you could set up a script on your credentialed server that will simply use Jupyter’s built-in export options to create the static HTML files and then send those to a more publicly accessible server.
Google has recently made public its internal Collaboratory project (link here). You can start a notebook in the same way as starting a Google Sheet or Google Doc, and then simply share the notebook or add collaborators..
For now, this is the easiest way for me.
Michael’s suggestion of running your own nbviewer instance is a good one I used in the past with an Enterprise Github server.
Another lightweight alternative is to have a cell at the end of your notebook that does a shell call to nbconvert so that it’s automatically refreshed after running the whole thing:
!ipython nbconvert <notebook name>.ipynb --to html
EDIT: With Jupyter/IPython’s Big Split, you’ll probably want to change this to
!jupyter nbconvert <notebook name>.ipynb --to html now.
It depends on what you are intending to do with your Notebook: do you want that the user can recompute the results or just playing with them?
NBViewer is a great tool. You can directly use it inside Jupyter.
Github has also a render, so you can directly link your file (such as https://github.com/my-name/my-repo/blob/master/mynotebook.ipynb)
If you want your user to be able to recompute some parts, you can also use MyBinder. It takes some time to start your notebook, but the result is worth it.
As said by @Mapl, Google can host your notebook with Colab. A nice feature is to compute your cells over a GPU.
A great way of doing this on WordPress consists of the following steps:
Step 1: Open your Jupyter notebook in a text editor and copy the content which may look like so:
Your .ipynb file may look like this when opened in a text editor
Step 2: Ctrl + A and Ctrl + C this content. Then Ctrl + V this to a GitHub Gist that you should create.
Step 3: Create a public gist and embed the gist like you always embed gists on WordPress, viz., go to the HTML editor and add like so:
I have actually implemented this on my blog. You can find the post here