How do you share notebooks? Best practices around sharing to external stakeholders?

I’ve recently set up a Z2JH instance internally and enabled shared storage for JupyterHub users. This means they have a common folder then can drop notebooks in and then use in their current pod. What this doesn’t solve is sharing to external customers (Managers, Product, Sales, etc). I’m beginning to research and collect ideas but was curious how other people are solving this? To give some context, we are looking for something where we can share static (or perhaps minimally interactive) notebooks, while still enforcing authentication (this is why nbviewer doesn’t look promising at the moment). I’ve also been looking into Binder but given the same concerns about authentication, I’m not sure how I would structure the git backend as we don’t have public repos.

I’d be really interested to hear peoples input on this!
Cheers,
Josiah

EDIT: Also, if this is the wrong category to post this under, let me know!

Side note: you can run your own BinderHub and enable authentication. This means only people with an account can access the hub and the hub can access private repositories.

However I am not sure that Binder is a good answer because you mention “static, or minimally interactive”. I’ve been experimenting with a “export to PDF” approach for sharing. The thinking here was that most people in the world can view a PDF (or their email client will even preview it inline for them). However you lose all interactivity. So maybe the better thing to share is a HTML file with everything inlined? Though it seems most email clients aren’t very smart about previewing HTML files.

Maybe Voila would work? From And Voilà!. … from Jupyter notebooks to standalone… | by QuantStack | Jupyter Blog

Another challenge with sharing notebooks is the security model. How can we offer the interactivity of a notebook making use of e.g. Jupyter widgets without allowing arbitrary code execution by the end user?

Examples: https://voila-gallery.org/

1 Like

I’ve been reading a bit more about a local BinderHub install, this looks promising. We can’t host our notebooks in GitHub due to sensitive data (even if it’s a private repo), but I might be able to run a local git instance on our k8s server and attach that to BinderHub. I might explore this a bit more.

1 Like

This also looks promising, thanks! I had not heard of Voila.

I run a jupyterhub instance for our data team (<10 active users). I found that installing nbviewer alongside jupyterhub (configured with the user directories as a localfile source) was a lightweight option to provide unauthenticated, non-interactive read-only access to notebooks for sharing with other users.

This is admittedly not a very rich solution, and nbviewer is a bit of a pain to configure to use in this way (need to write a big JSON blob to configure routing), but it solves the 90% case without requiring any authentication or state management.

I previously had a custom widget for for the classic notebook which generated the nbviewer URL for the current notebook to provide a quick “click here for read only link” button. Haven’t got round to converting it to jupyterlab yet.

2 Likes

Hi,

in my previous company, our small data team wanted to share the results of analyses performed on notebooks with the rest of our teammates. The idea was to have static HTML reports with interactive charts.

To do that, we had a folder with the notebooks to be executed. A cron job was executing the notebooks, thanks to a Python script, on a regular basis – allowing for updates – and the resulting generated HTML files, from a custom Jinja template, were sent to a S3 bucket. The reports were shared through a simple website with a Flask backend which allowed us to manage the authentication the way we wanted.

It was relatively straightforward to set up and easy to maintain. It may give you ideas for your problem.

2 Likes

Hey all - another tool you might find useful for this is Jupyter Book. It lets you bundle collections of notebooks and share them as an HTML book.

Https://Jupyterbook.org

We are in the middle of reworking the backend, so the current “beta” version will be ready for users soon, and will support all kinds of cool things like cross refs, citations, etc. it should also be much easier to install and use since it will be a fully python stack: https://beta.jupyterbook.org/intro.html

1 Like

thanks for posting this! we may very well go this route if we find that something like voila won’t work for us. I definitely appreciate the simplicity of an approach like this, which allows us to iterate and make it as complex as needed. Also really appreciate everyones input on this topic!

I’m working on a JupyterHub extension that turns an existing single-user Notebook into an interactive Voila version of that notebook which can be shared with an explicit list of external shareholders.

I’d be really interested to interview in more detail anyone with the kind of requirements discussed in this thread. It would be really informative to help shape my open source project if I can deep dive into your current setups and future wishes!

Please get in touch if you think you can help at all - basically anyone who needs to share the results of interactive Jupyter notebooks with a group of non-technical users. Email dan@ideonate.com and we’ll set up a call or text chat.

@josibake - I just tried to get in touch with you directly to see if I could help. No problem if you aren’t in a position to speak, but I’d be really pleased to talk through my research and your own experience so far if you do get a chance!

1 Like

Hey Dan, just sent you an email. Happy to discuss / contribute!

It would be great if we could get a summary or similar from your private exchanges posted here for posterity. That way the knowledge and interesting questions doesn’t get lost in private inboxes :smiley:

@betatim yes of course

1 Like

Just to tie threads together, a solution for sharing notebooks with non-technical users can be found in my JupyterHub Dashboards project.

This extends JupyterHub so a Notebook server can be cloned into a user-friendly Voila dashboard version which can be immediately and securely viewed by other authenticated users.

2 Likes

Please check out this example for Jupyter Voila that includes authentication, authorization and securing source application (also would work if your app is behind a firewall - i.e. runs on your local server / PC).

2 Likes

I also get the same problem about sharing nb with jhub?Have you solve it?

I’ve created a framework called Mercury for sharing notebooks with non-technical stakeholders. It converts Jupyter Notebook to a web application - it can be a web app, report, dashboard, presentation, or REST API. It generates widgets for the notebook based on the YAML configuration. The end-user can tweak widgets values and execute the notebook with new parameters. The resulting notebook can be downloaded as a single HTML or PDF file.

The example notebook with YAML header:

The web app generated from the notebook with Mercury:

Some nice features of Mercury:

  • authentication can be added with one line in the YAML share: private. Only logged users can see the notebook,
  • you can schedule the notebook execution with a crontab string, like schedule: '0 8 * * 1' - to execute the notebook every Monday at 8:00,
  • you decide to show or hide the code with the show-code parameter,
  • you can share multiple notebooks - there is a built-in app gallery,
  • easy deployment to Heroku or HuggingFace,
  • deployment with docker-compose to AWS, GCP, Azure, DigitalOcean, OVH, … - any cloud provider. Deployments with docker-compose have HTTPS support with certificates from Let’s Encrypt.

Here is my article on how to share Jupyter Notebook with non-programmers.

1 Like