Coder Social home page Coder Social logo

timkpaine / jupyter-fs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jpmorganchase/jupyter-fs

1.0 1.0 0.0 4.26 MB

A filesystem-like contents manager for multiple backends in Jupyter

License: Apache License 2.0

Shell 1.91% JavaScript 3.57% Python 31.00% PowerShell 0.66% TypeScript 58.04% CSS 3.48% Makefile 1.33%

jupyter-fs's Introduction

jupyter-fs

build status pypi package npm package

A plugin for JupyterLab that lets you set up and use as many filebrowsers as you like, connected to whatever local and/or remote filesystem-like resources you want.

The backend is built on top of PyFilesystem, while the frontend is built on top of JupyterLab Filetree.

Install

pip install jupyter-fs

Configure

Add the following to your jupyter_server_config.json:

{
  "ServerApp": {
    "contents_manager_class": "jupyterfs.metamanager.MetaManager",
    "jpserver_extensions": {
      "jupyterfs.extension": true
    }
  }
}

Simple use (no auth/credentials)

Add specifications for additional contents managers in your user settings (in the Settings menu under Advanced Settings Editor -> jupyter-fs). Here's an example config that sets up several new filebrowsers side-by-side:

{
  "resources": [
    {
      "name": "root at test dir",
      "url": "osfs:///Users/foo/test"
    },
    {
      "name": "s3 test bucket",
      "url": "s3://test"
    },
    {
      "name": "s3 test key",
      "url": "s3://test-2/prefix/",
      "defaultWritable": false
    },
    {
      "name": "samba guest share",
      "url": "smb://[email protected]/test?name-port=3669"
    }
  ]
}

You should see your new filebrowsers pop up in the left-hand sidebar instantly when you save your settings:

Use with auth/credentials

Any stretch of a "url" that is enclosed in double-brackets {{VAR}} will be treated as a template, and will be handled by jupyter-fs's auth system. For example, you can pass a username/password to the "samba guest share" resource in the Simple use example above by modifying its "url" like so:

{
  "resources": [
    ...

    {
      "name": "samba share",
      "url": "smb://{{user}}:{{passwd}}@127.0.0.1/test?name-port=3669"
    }
  ]
}

When you save the above "resouces" config, a dialog box will pop asking for the username and passwd values:

Once you enter those values and hit ok, the new filebrowsers will then immediately appear in the sidebar:

The auth dialog will only appear when needed

The jupyter-fs auth dialog will only appear when:

  • JupyterLab first loads, if any fs resources reqiure auth
  • a new fs resouce is added that requires auth, or its "url" field is modified

Supported filesystems

The type of resource each filebrowser will point to is determined by the protocol at the start of its url:

  • osfs: os filesystem. The will open a new view of your local filesystem, with the specified root
  • s3: opens a filesystem pointing to an Amazon S3 bucket
  • smb: opens a filesystem pointing to a Samba share

jupyter-fs can open a filebrowser pointing to any of the diverse resources supported by PyFilesystem. Currently, we test only test the S3 and smb/samba backends as part of our CI, so your milleage may vary with the other PyFilesystem backends.

The filesystem url

The "url" field jupyter-fs config is based on the PyFilesystem opener url standard. For more info on how to write these urls, see the documentation of the relevant PyFilesystem plugin:

Server-side settings

If you prefer to set up your filesystem resources in the server-side config, you can do so. For example, you can set up a local filesystem by adding the following to your jupyter_server_config.py file:

c.JupyterFs.resources = [
    {
        "name": "local_test",
        "url": "osfs:///Users/foo/test"
    },
]

ALternatively, you can add resource specifications alongside the basic jupyter-fs config in your jupyter_server_config.json file:

{
  "ServerApp": {
    "contents_manager_class": "jupyterfs.metamanager.MetaManager",
    "jpserver_extensions": {
      "jupyterfs.extension": true
    }
  },
  "JupyterFs": {
    "resources": [
      {
        "name": "local_test",
        "url": "osfs:///Users/foo/test"
      }
    ]
  }
}

Any filesystem resources specified in any server-side config file will be merged with the resources given in a user's settings.

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.

jupyter-fs's People

Contributors

telamonian avatar timkpaine avatar vidartf avatar dependabot[bot] avatar davemalvin avatar jacob-frazer avatar reoono avatar mahendrapaipuri avatar jpmckmb avatar ceball avatar logan-hcg avatar manthankeim avatar paulkgrimes avatar

Stargazers

Keegan McCallum avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.