Skip to content

data-8/nbgdrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nbgdrive

A Google Drive extension for Jupyter notebook. Automatically creates a sync directory for the user on Google Drive and autosyncs their files every 24 hours. Adds a button to allow users to sync whenever they need to.

Installation

You can currently install this directly from git:

pip install git+https://github.com/data-8/nbgdrive.git
jupyter serverextension enable --py nbgdrive
jupyter nbextension install --py nbgdrive

To enable this extension for all notebooks:

jupyter nbextension enable --py nbgdrive

Important Note

This repository was made specifically for UC Berkeley's Data 8 class, and as such, makes assumptions about the location of your work directory with which we are to sync files upstream. It currently matches some Docker images we use, and defaults to /home/jovyan. Please note that if the structure of your directory does not match, you will be unable to sync files to Google Drive. Before we make a fix to this, you can still use this repository by changing this file directory to whatever local directory you will be using. Then, please rerun the above commands. In this directory, you can run:

pip uninstall nbgdrive
pip install .
jupyter serverextension enable --py nbgdrive
jupyter nbextension install --py nbgdrive
jupyter nbextension enable --py nbgdrive

Usage

Once correctly installed, you can login with Google Drive in order to grant nbgdrive the required permissions to run.

nbgdrive Screenshot 1

You will be redirected to a new page where you will be given a verification code to insert back in a text field in the Jupyter Notebook, as shown below:

nbgdrive Screenshot 2

Once you are successfully logged in, you will be able to Sync manually by pressing the cloud button. Otherwise, nbgdrive will sync your directory automatically whenever you haven't synched in the past 24 hours.

nbgdrive Screenshot 3

Syncing

Syncing will create a sync folder in the main directory of your Google Drive, and upstream sync to it the contents of the Jupyter Notebook directory /home/jovyan. As this tool was created with UC Berkeley's Data 8 class in mind, the default folder structure will be named Jupyter/Nbgdrive.

Tampering with the contents or location of the sync folder will cause nbgdrive to break. To fix any such issue, it's recommended to log out (through the logout button next to the sync button), delete any preexisting synced folders on your Google Drive account, and reauthenticate Google Drive.

Installation and Dependencies

There are a few dependencies required for this repository to function currectly. Underlying nbgdrive is a Google Drive CLI. You must install and give this tool proper access before using nbgdrive. Please ensure this tool exists on your $PATH, by putting in the default /usr/bin or by modifying your bash_profile.

On unix based systems, after downloading gdrive, you must make it executable by running a chmod +x gdrive command, before mv gdrive /usr/bin. Alternatively, you can use brew install gdrive.

Additionally, there are Selenium tests located in the tests subdirectory. To run these tests, first pip install selenium. Depending on what browsers you'd like to test for, you will also need to download some drivers and place them in your /usr/bin directory.

Cal Blueprint

Blueprint Banner

This project was worked on in close collaboration with Cal Blueprint. Cal Blueprint is a student-run UC Berkeley organization devoted to matching the skills of its members to our desire to see social good enacted in our community. Each semester, teams of 4-5 students work closely with a non-profit to bring technological solutions to the problems they face every day.

About

NB extension for Google Drive file sync'ing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published