• Stars
    star
    417
  • Rank 100,204 (Top 3 %)
  • Language
    TypeScript
  • License
    BSD 2-Clause "Sim...
  • Created over 9 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Google drive for jupyter notebooks

Google Drive support for Jupyter Notebook

Deprecation Notice

The jupyter-drive project is no longer supported due to the deprecation of the Google Realtime API.

You might instead consider jupyterlab/jupyterlab-google-drive; which adds a Google Drive file browser to the left sidebar of JupyterLab.

Installation

This repository contains custom Contents classes that allows IPython to use Google Drive for file management. The code is organized as a python package that contains functions to install a Jupyter Notebook JavaScript extension, and activate/deactivate different IPython profiles to be used with Google drive.

To install this package, run

git clone git://github.com/jupyter/jupyter-drive.git
pip install -e jupyter-drive

This will install the package in development mode with pip, which means that any change you make to the repository will be reflected into the importable version immediately.

To install the notebook extension and activate your configuration with Google Drive, run

python -m jupyterdrive

To deactivate, run

python -m jupyterdrive --deactivate

Note on Jupyter/IPython

We try to support both IPython 3.x and above version, though many changes in configuration between IPython 3.x and later versions may cause the exact configuration path to vary from system to system.

Symlink files

By default all the Javascript files will be symlinked, so any update to the package python or javascript will be reflected on your python server. Use the --no-symlink option to actually copy the file on their final destination.

Mixed contents

You can also install the MixedContentsManager, to do so install as before with the --mixed options. For example, on the default profile:

python -m jupyterdrive --mixed

The mixed content manager will show contents from both the local hard drive and the remote google drive as two directories in your dashboard.

mixed content configuration.

All of the following files should be created automatically the first time that you run the content manager. You might need to modify these files manually to get the contents manager to work.

To modify the configuration of the mixed contents manager you need to update the following files:

Under Jupyter/IPython 4.x+ <config-dir>/jupyter_notebook_config.json which by default should have the following structure :

{
  "nbformat": 1,
  "NotebookApp": {
    "contents_manager_class": "jupyterdrive.mixednbmanager.MixedContentsManager",
    "tornado_settings": {
      "contents_js_source": "nbextensions/gdrive/mixed-contents"
    }
  },
  "MixedContentsManager":{
    "filesystem_scheme": [
        {
          "root":"local",
          "contents":"IPython.html.services.contents.filemanager.FileContentsManager"
        },
        {
          "root": "gdrive",
          "contents": "jupyterdrive.clientsidenbmanager.ClientSideContentsManager"
        }
      ]
  }

}

Under IPython 3.x This file would be <profile>/ipython_notebook_config.json.

The root field of filesystem_scheme represents the name that would be used as the virtual mount points for the contents manager in the dashbord and should be consistent with the name given in nbconfig/common.json described below.

The contents field contains the fully qualified name of a Contents manager to mount on the mountpoint.

The second config file that deals with configuring the frontend should be:

  {
    "schema": [
      {
        "stripjs": false,
        "contents": "services/contents",
        "root": "local"
      },
      {
        "stripjs": true,
        "contents": "./drive-contents",
        "root": "gdrive"
      }
    ]
  }

To modify it, in a notebook access the config object, and extract default value: >>> data = IPython.notebook.contents.config.data . Change one of the values, for example : >>> data.mixed_contents.schema[0].root = 'new_root'. Update the config to the new value : >>> IPython.notebook.contents.config.update(data).

As stated previously the root value should match python side config file, contents represents the client-side content manager that need to be used. stripjs is a boolean value that indicates whether the name of the mount point should be stripped from the various paths on the javascript side before passing it to the different subcontent managers.

Other options

If IPython has been installed system wide, in a virtual environment or with some custom setup you might need to pass --user, -prefix <prefix> or --path <path> option to install the extension in a user-owned profile location.

See python -m jupyterdrive --help for more information.

deactivate a profile

It is not yet possible to deactivate the drive integration automatically. But you can get rid of ~/.ipython/profile_defaut/ipython_notebook_config.json config file to deactivate Google Drive as well as other config options.

The configuration of IPython/Jupyter is done through the .json file in the profile and will take precedence on configuration done in .py files, though you can still use non conflicting options.

First launch

Launch IPython with the profile in which you activated jupyter-drive:

ipython notebook --profile <profilename>

On first launch, the application will ask you for the authorization to access your files on Google Drive. It only asks for permission to create new files or to access files it has created or that you manually open with this application. It also requires permission to access file/directory metadata, in order to display the list of files/directories in the tree view.

The request pop-up looks like the following:

auth screenshot

Clicking ok will open a Google OAuth pop-up. You will see that the Jupyter Drive application wants access to some information about your files. Keep that in mind if you want to revoke access at a later point.

Once you click Accept you should be able to start creating new notebooks on Google Drive, and open existing ones created by this application, and view files/directories in the tree view.

Advanced configuration

The contents manager can access the common section of nbconfig, thus you can set config values in <profile_dir>/nbconfig/common.json. The default values that are used are the following:

{"gdrive":
    {
    "METADATA_SCOPE": true,
    "FILE_SCOPE": true,
    "CLIENT_ID": "763546234320-uvcktfp0udklafjqv00qjgivpjh0t33p.apps.googleusercontent.com"
    }
}

The APP_ID section is not yet configurable, but should be configurable in the same way at some point in the future.

Developing

The client-side code for jupyter-drive is written in TypeScript. The TypeScript transpiler can be installed using npm:

npm install

The JavaScript may then be re-compiled using npm run:

npm run gulp js

More Repositories

1

jupyter

Jupyter metapackage for installation, docs and chat
Python
14,721
star
2

notebook

Jupyter Interactive Notebook
Jupyter Notebook
11,046
star
3

docker-stacks

Ready-to-run Docker images containing Jupyter applications
Python
7,704
star
4

nbdime

Tools for diffing and merging of Jupyter notebooks.
TypeScript
2,584
star
5

nbviewer

nbconvert as a web service: Render Jupyter Notebooks as static web pages
Python
2,152
star
6

nbconvert

Jupyter Notebook Conversion
Python
1,648
star
7

nbgrader

A system for assigning and grading notebooks
Python
1,251
star
8

dashboards

[RETIRED] See VoilΓ  as a supported replacement
Jupyter Notebook
981
star
9

colaboratory

[deprecated] Jupyter CoLaboratory, goto google colab now
JavaScript
739
star
10

tmpnb

Creates temporary Jupyter Notebook servers using Docker containers. [DEPRECATED - See BinderHub project]
JavaScript
527
star
11

qtconsole

Jupyter Qt Console
Python
391
star
12

terminado

Terminals served by tornado websockets
Python
352
star
13

jupyter_client

Jupyter protocol client APIs
Python
350
star
14

atom-notebook

[Deprecated] Jupyter Notebook, but inside Atom.
JavaScript
307
star
15

help

✨ Need some help or have some questions? Please visit our Discourse page.
291
star
16

jupyter_console

Jupyter Terminal Console
Python
240
star
17

nbformat

Reference implementation of the Jupyter Notebook format
Python
240
star
18

jupyter_core

Core Jupyter functionality
Python
191
star
19

docker-notebook

Docker containers for the IPython notebook (+SciPy Stack)
Shell
188
star
20

dashboards_server

[RETIRED] Server that runs and renders Jupyter notebooks as interactive dashboards
JavaScript
181
star
21

jupyter-sphinx

Sphinx extension for rendering of Jupyter interactive widgets.
Python
180
star
22

jupyter.github.io

Project Jupyter's home on the World Wide Web
HTML
175
star
23

nbconvert-examples

Examples that illustrate how nbconvert can be used
Jupyter Notebook
163
star
24

kernel_gateway_demos

Demos associated with the kernel gateway incubator project
Jupyter Notebook
146
star
25

nbclient

A client library for executing notebooks. Formally nbconvert's ExecutePreprocessor
Python
133
star
26

declarativewidgets

[RETIRED] Jupyter Declarative Widget Extension
HTML
120
star
27

enhancement-proposals

Enhancement proposals for the Jupyter Ecosystem
Python
112
star
28

roadmap

Master roadmap for Project Jupyter
84
star
29

papyri

Python
81
star
30

design

Design related materials for Project Jupyter
HTML
80
star
31

governance

The governance process and model for Project Jupyter
Python
80
star
32

dashboards_bundlers

[RETIRED] Converts a notebook to a dashboard and deploys it / downloads it
Python
79
star
33

docker-demo-images

Demo images for use in try.jupyter.org and tmpnb.org
Jupyter Notebook
75
star
34

scipy-advanced-tutorial

Advance Tutorial For SciPy
JavaScript
75
star
35

nb2kg

Python
73
star
36

services

This repository is deprecated. It has been moved to https://github.com/jupyterlab/jupyterlab as a sub-package
TypeScript
70
star
37

accessibility

A repository for ongoing work around making Jupyter's software accessible and inclusive
Python
65
star
38

jupyter-packaging

Tools to help build and install Jupyter Python packages
Python
62
star
39

jupyter_kernel_test

A tool for testing Jupyter kernels
Python
61
star
40

nbclassic

Jupyter Notebook as a Jupyter Server extension
JavaScript
56
star
41

nbmanager

View and stop running IPython notebook servers
Python
50
star
42

ngcm-tutorial

Materials for the IPython/Jupyter workshop at the NGCM Summer Academy, at Southampton University, Boldrewood campus.
Jupyter Notebook
46
star
43

jupyter-js-notebook

JupyterLab notebook
TypeScript
46
star
44

telemetry

Configurable event-logging for Jupyter applications and extensions.
Python
45
star
45

debugger

Research and explorations for an interactive debugger for Jupyter
41
star
46

echo_kernel

A simple example kernel for Jupyter
Python
38
star
47

ipython-py3k

**DO NOT USE THIS REPOSITORY AT ALL** This repo has been merged into the main IPython one that now contains Python 3 support. This is kept only as a reference to developers.
Python
34
star
48

jsplugins

JavaScript Plugins for the IPython Notebook
32
star
49

jupyterhub-2016-workshop

Materials for an online mini-workshop around JupyterHub use cases, held July 22nd, 2016
31
star
50

dashboards_setup

[RETIRED] Recipes for setting up components related to the incubating dashboards effort
Jupyter Notebook
28
star
51

testpath

Test utilities for Python code working with files and commands
Python
26
star
52

strata-sv-2015-tutorial

Strata Silicon Valley 2015 Tutorial
Python
24
star
53

jupyter-js-plugins

TypeScript
23
star
54

jupyter-sphinx-theme

A Sphinx theme for Jupyter and IPython documentation
HTML
22
star
55

jvm-repr

API for converting JVM objects to representations by MIME type, for the Jupyter ecosystem.
Java
22
star
56

surveys

Surveys and datasets collected by Project Jupyter
Jupyter Notebook
21
star
57

tutorial-dashboards-declarativewidgets

Materials for the PyData Carolinas 2016 tutorial, Turning Jupyter Notebooks into Data Applications
Jupyter Notebook
19
star
58

tmpnb-deploy

Deploying tmpnb nodes
Python
18
star
59

notebook-research

Research on the usage of Jupyter notebooks
Jupyter Notebook
18
star
60

security

18
star
61

jupyterlab_json

This repository is deprecated. The extension has moved to https://github.com/jupyterlab/jupyter-renderers
JavaScript
16
star
62

kernels

Kernel testing and listing infrastructure
Python
16
star
63

mozfest15-training

Notebooks for Jupyter training session at Mozfest 2015
Jupyter Notebook
13
star
64

newsletter

A repo for collecting content for the Jupyter Newsletter
Jupyter Notebook
13
star
65

jupyterlab_geojson

This repository is deprecated. The extension has moved to https://github.com/jupyterlab/jupyter-renderers
JavaScript
13
star
66

tmpnb-redirector

Simple HTTP redirector for tmpnb nodes
Python
12
star
67

nature-demo

Materials for the November 2014 Nature Article
Jupyter Notebook
12
star
68

extension-builder

This repository is deprecated.
TypeScript
12
star
69

phosphor-notebook

Phosphor-based jupyter notebook
TypeScript
11
star
70

ipython-components

third-party javascript dependencies of IPython
JavaScript
11
star
71

jupyter-js-output-area

DEPRECATED: Javascript APIs for Jupyter output areas
TypeScript
10
star
72

cookiecutter-docker-stacks

Cookiecutter for community-maintained Jupyter Docker images
Python
10
star
73

ideas

A place for the Jupyter community to connect on ideas
9
star
74

try.jupyter.org

Try Jupyter!
HTML
9
star
75

jupyter_events

Configurable event system for Jupyter applications and extensions.
Python
9
star
76

jupyter-js-ui

TypeScript
9
star
77

kernel_gateway_bundlers

Converts a notebook to a kernel gateway microservice bundle for download
Python
8
star
78

jupyter_markdown

Documentation and tests related to Jupyter's Markdown syntax
Jupyter Notebook
8
star
79

try-jupyter

A JupyterLite deployment to try JupyterLab, Jupyter Notebook and IPython in the browser
Jupyter Notebook
8
star
80

talks

A collection of talks about Jupyter and IPython projects
Jupyter Notebook
8
star
81

jvm-magics

A plugin system for magic function implementations across JVM kernels.
Java
7
star
82

jupyter-js-utils

JavaScript utilities for the Jupyter frontend
TypeScript
6
star
83

cdn.jupyter.org

Assets and layout for cdn.jupyter.org
Python
6
star
84

jupyter_logger

Allows you to log Jupyter notebook user events anonymously.
TypeScript
6
star
85

jupyter-js-filebrowser

DEPRECATED: This code was copied into https://github.com/jupyter/jupyter-js-ui
TypeScript
5
star
86

jupyter-sprints

Resources for running a sprint
HTML
5
star
87

docs-team-compass

Documentation Work Group Discussions
HTML
5
star
88

nbcache

Notebook Caching layer in Docker
5
star
89

sphinxcontrib_github_alt

Github roles for Sphinx docs
Python
5
star
90

jupyter-js-input-area

DEPRECATED: Javascript APIs for Jupyter input areas
TypeScript
5
star
91

jupyterhub-carina

[RETIRED] JupyterHub integration with Carina
Python
5
star
92

win-tornado-terminals

Windows terminal backend for tornado
Python
5
star
93

jupyterlab-fasta

DEPRECATED: Moved to https://github.com/jupyterlab/jupyter-renderers. A JupyterLab Fasta viewer
TypeScript
5
star
94

spreadsheet

A spreadsheet component for phosphor
JavaScript
5
star
95

notebook_shim

A shim layer for notebook traits and config
Python
4
star
96

jupyter-js-editor

DEPRECATED: This code was copied into https://github.com/jupyter/jupyter-js-notebook
TypeScript
4
star
97

jupyter-communitycalls

πŸ“£ Resources for planning and hosting the Jupyter Community Calls
4
star
98

project-mgt

4
star
99

tutorial-devteam-jupyterhub-2017

Resources for the dev team tutorial on JupyterHub 2017-01-27
4
star
100

showcase

[RETIRED] A spot to try demos of one or more incubating Jupyter projects in Binder
Makefile
4
star