Jupyter-FS

A filesystem-like ContentsManager backend for Jupyter. This library allows you to hook up multiple file backends to Jupyter and interact with their contents using JupyterLab Filetree.

https://dev.azure.com/tpaine154/jupyter/_apis/build/status/jpmorganchase.jupyter-fs?branchName=masterBuild Status https://img.shields.io/github/issues/timkpaine/jupyter-fs.svgGitHub issues https://img.shields.io/azure-devops/coverage/tpaine154/jupyter/23Coverage https://img.shields.io/pypi/l/jupyter-fs.svgPyPI https://img.shields.io/pypi/v/jupyter-fs.svgPyPI https://img.shields.io/npm/v/jupyter-fs.svgnpm

Install

pip install jupyter-fs
jupyter labextension install jupyter-fs
jupyter serverextension enable --py jupyter-fs

Configure

Add the following to your jupyter_notebook_config.json:

{
  "NotebookApp": {
    "contents_manager_class": "jupyterfs.meta_contents_manager.MetaContentsManager",
    "nbserver_extensions": {
      "jupyterfs": true
    }
  }
}

Register additional contents managers in your jupyter_notebook_config.py. As an example, an S3Contents manager is added as follows:

from s3contents import S3ContentsManager
c.JupyterFS.contents_managers = \
{
    's3': S3ContentsManager
}


c.S3ContentsManager.bucket = '<your bucket>'

## SECRET
c.S3ContentsManager.access_key_id = '<your access key>'
c.S3ContentsManager.secret_access_key = '<your secret key>'

During application startup, you should see something like this in the logs:

JupyterFS active with 2 managers
Installing JupyterFS handler on path /multicontents

And in the UI, you will see your contents managers available: https://raw.githubusercontent.com/timkpaine/jupyter-fs/master/docs/example.gif

We can add additional contents managers:

c.MultiContentsManager.contents_managers = \
{
    's3': S3ContentsManager,
    'file2': AbsolutePathFileManager(root_dir=os.path.expanduser("~/Downloads"))
}

Here I utilize an AbsolutePathFileManager to grab another folder on my system for use. Remember, remote filesystems are still remote, and locally you may need to move around the filesystem with a os.chdir command (or equivalent in other languages).

Here, I have the above s3 and AbsolutePathFileManager, along with the original contents manager, for a total of 3 seperate spaces.

https://raw.githubusercontent.com/timkpaine/jupyter-fs/master/docs/example2.gif

Development

See CONTRIBUTING.md for guidelines.

License

This software is licensed under the Apache 2.0 license. See the LICENSE and AUTHORS files for details.# API Documentation

class jupyterfs.extension.GetHandler(application: tornado.web.Application, request: tornado.httputil.HTTPServerRequest, **kwargs)[source]

Bases: notebook.base.handlers.IPythonHandler

get()[source]

Returns all the available contents manager prefixes

e.g. if the contents manager configuration is something like: {

“file”: LargeFileContentsManager, “s3”: S3ContentsManager, “samba”: SambaContentsManager

}

the result here will be: [“file”, “s3”, “samba”]

which will allow the frontent to instantiate 3 new filetrees, one for each of the available contents managers.

initialize(keys=None)[source]
jupyterfs.extension.load_jupyter_server_extension(nb_server_app)[source]

Called when the extension is loaded.

Parameters:nb_server_app (NotebookWebApplication) – handle to the Notebook webserver instance.