danielballan/nbexamples

Support For Other `c.NotebookApp.contents_manager_class`?

Opened this issue · 4 comments

I have nbexamples configured with jupyterhub and it's working great, but would like to persist my notebooks outside the server file system.

I would like to use https://github.com/quantopian/pgcontents which replaces the c.NotebookApp.contents_manager_class. Do you know how nbexamples will handle this?

Sorry for the delay, @jlmcgehee21. I got way behind on my github notifications. Jason Grout mentioned your pgcontents class. We might be deploying a custom contents class of our own at Brookhaven National Lab so this is relevant to my day-job interests as well.

As written, nbexamples will not handle that well. It calls out to the system to copy, move, and delete example files instead of going through the contents manager. Unfortunately, if we restricted ourselves to the built-in contents manager API, there would be no way for users exchange examples with each other. A given user's server (and contents manager) can only access files within their home directory; nbexamples needs to reach out to some public location like /usr/share. The "right" way to handle this is probably to incorporate a hub extension along with the server extension.

What do you think?

No problem @danielballan I pretty much came to that conclusion re: the current nbexamples setup. A simple work-around (but not perfect by any means) has been to auto-commit the examples directories to a github repo. Would definitely still love to work out a database storage solution though.

Not sure exactly how a hub extension would fit in here? Feel free to elaborate.

perhaps the nbexamples extension could create or rely on a nbexamples user whose notebook directory is readable by others and managed by the c.NotebookApp.contents_manager_class?

I'm fairly new to configuring large scale jupyter-based systems (have been running it locally for years) but it has recently become part of my day job as well, so I would be interested in contributing to anything that would yield some sort of nbexamples/pgcontents hybrid.

Great, I'd be glad for someone to work with on this. :- )

Here's what I'm think re: the hub extension. Two users' notebook servers can't share content without cheating -- side-banding through the filesystem (as nbexamples does) or side-banding through some database or in general going outside the official ContentsManager API. But the hub has global access to all the users' content and access to one central filesystem where examples could be stashed and served. So, a hub extension could add an API endpoint like /hub/examples/<action> that accepts requests from the servers.

There might actually already be some work done along these lines. Before jumping in, I want to sit through this video sometime soon and find out what others have been doing with the Hub: https://www.youtube.com/watch?v=VnMSjR5IoS8