Giter Site home page Giter Site logo

jupyter-drive's Introduction

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

jupyter-drive's People

Contributors

carreau avatar ellisonbg avatar filmor avatar kestertong avatar ptone avatar rgbkrk avatar rjw57 avatar stared avatar takluyver avatar westurner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyter-drive's Issues

Can't open Google Drive subdirectories -- server error: the folder/file does not exist

I've successfully installed JD, have authenticated to GD, and can see my top-level GD directory. I can drill down into one subdirectory, and I can see the files and sub-sub-directories. However I'm unable to open any of the sub-sub-directories. Whenever I try I can see JD using the GD APIs, but after 20 or 30 secs I seem to get a timeout and then this server error failure. Any ideas? I apologize for not being equipped to debug the problem myself.

Image files not rendered

python version: 3.4.3 |Anaconda 2.2.0 (64-bit)|
IPython.__version__: 4.0.0

I'm getting the broken image icon in both of these cases:

  • <img src="filename.jpg>" in a markdown cell
  • IPython.display.Image("filename.jpg") in a code cell

Image files are in the same folder as the notebook.

Clicking the image filename in the tree browser brings up file picker. Clicked 'select' and restarted kernel/reload notebook, but same result (broken image icon).

SVG and JPG formats show same result.

All images render fine on the local filesytem.

Order files/directories by name in tree view

Currently the tree view gives random order (because Contents.list_contents returns random order). Even files and directories are mixed.

Drive has a complication that it is slow, and returns results in "paginated" form. I think the best approach is to download the entire contents (using max number of results, 1000, per page) then sort these results, and return.

Detect and handle specific API errors related to authorization/origin checks

One confusing thing for users with coLaboratory was that you have to run using specific ports (currently 8888-8908 I think) and it must be 127.0.0.1 not another address.

This cannot be avoided at present, but at least we can make it clear what is happening. The best approach is probably to detect these errors and throw a new error object in gapi_utils.wrap_result. Then check that this error propagates properly to the user.

There may be other authorization related errors that I've forgotten about that also need to be explained to the user.

Javascript v3->v4 converter ?

Do we need one, or do we assume there is only a minority of user with v3 notebook on dive ?

Or do we expose a way to drive-> browser -> server (upgrade) -> browser ?

Add instructions on using own client id

Currently, the hardcoded client id is configured to only accept origins 127.0.0.1:8888, 127.0.0.1:8889, ..., 127.0.0.1:8899. It is not possible (or advisable) to allow all origins, or even all ports. For most users this just means that they need to be aware of the limitation that they must user ports in this range.

If a user wants to run their own server from a different domain, they will have to create their own cloud console project and modify the client id.

If there is demand for this, we should add documentation and possibly the ability to set the client id through configuration (though this should be done carefully wrt security).

hardcoded `client_id`

Just to remind me to investigate the storing of client_id and other things in secure place, and/or have a way for people to provide their own. Because I guess as all the info are in this repo they could be reused ?

Rename doesn't permanently change notebook title

After renaming a notebook, even though the filename is correctly modified, the title of the notebook will revert if the notebook is reloaded.

E.g. create new notebook
filename: "Untitled4.ipynb"
title: "Untitiled4"
rename:
filename: "My Notebook.ipynb"
title: "My Notebook"
after reloading the page
filename: "My Notebook.ipynb"
title: "Untitled4"

I suspect that there may be some server side "save" logic that puts the notebook title from the model, into the notebook JSON before saving.

Combine save and create checkpoint into a single function in Contents

Right now, it's inconvenient to have save and create checkpoint be separate functions. This is because both functions are asynchronous, so our current implementation creates a race condition, and sometimes the previous save gets checkpointed.

This problem would be solved if we got rid of create_checkpoint and instead had a checkpoint option in save.

Test with PG content.

Talked a bit with @ssanderson on gitter. I think he is interested in Mixed content manager.
If needed we can split it out of Jupyter-drive.

Any way, we can collaborate !

Error loading notebook

$ ipython --version
3.2.0

$ python --version
Python 2.7.9

$uname -mprsv
Darwin 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64 i386

I tried to open a ipynb file in my google drive and got this alert. There are no error logs printed by the ipython notebook server console.

image

image

No Auth Request for Google Drive - regular ipythonic notebook server?

Hi all,
I'm sure I'm missing something basic, but I was able to successfully clone, install a config and run ipython with the jupyterdrive profile, but when I open it I get a standard ipythonic server, and no auth request for Google Drive. Is there an additional config step not in the readme that I need to do? Sorry this is so basic, but I've been looking for an hour and can't find it. Using py3 and ipython 3
python -c 'import IPython; print(IPython.sys_info())'

Thanks for any suggestions,
Erik

{'commit_hash': 'cbccb68',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Users/kastman/miniconda/envs/py3/lib/python3.4/site-packages/IPython',
 'ipython_version': '3.1.0',
 'os_name': 'posix',
 'platform': 'Darwin-14.3.0-x86_64-i386-64bit',
 'sys_executable': '/Users/kastman/miniconda/envs/py3/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.4.3 |Continuum Analytics, Inc.| (default, Mar  6 2015, '
                '12:07:41) \n'
                '[GCC 4.2.1 (Apple Inc. build 5577)]'}

Deal with "clobbering" of Drive files

When two people have the same notebook open, or even when one person has the same notebook open in two tabs, the notebook will be written to by both notebook simultaneously. The long term solution is to use the realtime API. But in the meantime we need a way to warn the user that autosave is overwriting someone else's work.

I think this can be done without any changes to the interface. We will just show a dialog warning the user if another user/tab modified this file since last save. You can either proceed or cancel. If the user wants to restore, then can just close the tab and re-open (or refresh the tab).

Is it possible to auto-refresh?

When two people are editing the same file, is it possible to:

  • see their edits in real time? (alike in Google Docs)
  • see who is logged in, which cells they are working on?

As of now, I've found that it is possible to wait for their edits and refresh browser tab, but it sounds a lot like a brute-force solution (plus, it will be easy to erase someone's else edits).

New Cloud Console project and client ID

In order to use drive.file permission properly, and to avoid displaying "coLaboratory" when asking for permissions, an new cloud console project is needed, and a new client ID from this project.

Local notebooks cannot be renamed until `mkdir ~/local` is executed

I logged into a jupyter-hub + sudospawner installation using github oath. My user was created and I can create a new notebook w/in the "local" namespace but any attempt to rename a notebook results in the error:

Unknown error renaming file: Untitled1.ipynb [Errno 2] No such file or directory: '/home/aboyett/local/foo.ipynb'

when I look at the filesystem, the notebook is actually created at /home/aboyett/Untitled1.ipynb, there is no /home/aboyett/local by default. once I create that dir the rename succeeds.

This may vary well be misconfiguration, but as far as I this installation is using a stock configuration for jupyter-hub

Details about the installation:

> import IPython; print(IPython.sys_info())
{'commit_hash': 'f75fda4',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/local/lib/python3.4/dist-packages/IPython',
 'ipython_version': '3.0.0',
 'os_name': 'posix',
 'platform': 'Linux-3.13.0-46-generic-x86_64-with-Ubuntu-14.04-trusty',
 'sys_executable': '/usr/bin/python3',
 'sys_platform': 'linux',
 'sys_version': '3.4.0 (default, Apr 11 2014, 13:05:11) \n[GCC 4.8.2]'}

$ pip3 freeze | grep -E '(ipython|jupyter)'                                                       
ipython==3.0.0                                                                                                              
jupyterdrive==0.9.0                                                                                                         
jupyterhub==0.0.1-dev

/etc/jupyterhub/jupyterhub_config.py:

$ cat /etc/jupyterhub/jupyterhub_config.py | grep -v -E '(^$|^#)'                                 
c = get_config()                                                                                                            
c.JupyterHub.authenticator_class = 'oauthenticator.LocalGitHubOAuthenticator'                                  
<auth details elided>     

automatically created ~/.ipython/profile_default/ipython_notebook_config.json:

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

automatically created ~/.ipython/profile_default/nbconfig/common.json:

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

Support Python 3

There are a few non Python 3 compatible parts of this extension:

Step 5 : RUN python3 -m jupyterdrive
 ---> Running in 123ab3487524
Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/srv/jupyter-drive/jupyterdrive/__main__.py", line 2, in <module>
    jupyterdrive.install()
  File "/srv/jupyter-drive/jupyterdrive/__init__.py", line 20, in install
    activate(profile)
  File "/srv/jupyter-drive/jupyterdrive/__init__.py", line 45, in activate
    json.dump(config,f, indent=2)
  File "/usr/lib/python3.4/json/__init__.py", line 179, in dump
    fp.write(chunk)
TypeError: 'str' does not support the buffer interface

We should make sure this works in Python 3 by default. /cc @takluyver

Can't back out of "python -m jupyterdrive" to add "--mixed"

Hi folks,

I inadvertently executed "python -m jupyterdrive" rather than "python -m jupyterdrive --mixed", and now I can't figure out what persistent state is causing me to be unable to do "python -m jupyterdrive --mixed."
The problem appears to be revealed by these lines of code

with jconfig(profile) as config:
if 'NotebookApp' in config:
if (config['NotebookApp'].get('tornado_setting',{})) or (config['NotebookApp'].get('contents_manager_class',{})):
# TODO, manually merge tornado setting if exist
# but cannot do anything automatically if contents_manager_class is set
raise ValueError('You already got some configuration that will conflict with google drive. Bailin out')

I've deleted all the jupy* files in /usr/local/lib/.... I've uninstalled and reinstalled python3, ipython, etc. Perhaps someone can tell me what I need to do to clear the config['NotebookApp'] state so that I can install jupyter in mixed mode?

I'm trying to set up a VM for student use this fall.

Thanks!
KS

Notebook failed to load

I've got master of everything and here's what I get when I'm trying to open or create a notebook:

On screen:

Notebook failed to load
    The error was:
    TypeError: Cannot read property 'language_info' of undefined
    See the error console for details.

In server logs:

[W 12:45:44.344 NotebookApp] 404 GET /nbextensions/gdrive/drive-contents.js.map (172.17.42.1) 0.51ms referer=None
[W 12:45:45.963 NotebookApp] 404 GET /nbextensions/gdrive/notebook_model.js.map (172.17.42.1) 0.51ms referer=None
[W 12:45:46.318 NotebookApp] 404 GET /nbextensions/gdrive/driveutils.js.map (172.17.42.1) 0.51ms referer=None
[W 12:45:46.332 NotebookApp] 404 GET /nbextensions/gdrive/gapiutils.js.map (172.17.42.1) 0.51ms referer=None
[W 12:45:48.286 NotebookApp] 404 GET /nbextensions/gdrive/pickerutils.js.map (172.17.42.1) 0.51ms referer=None

In browser console:

    main.min.js?v=5566f41afe61754de29348272d979319:23
Default extension for cell metadata editing loaded.
    main.min.js?v=5566f41afe61754de29348272d979319:23
Raw Cell Format toolbar preset loaded.
    main.min.js?v=5566f41afe61754de29348272d979319:23
Slideshow extension for metadata editing loaded.
    main.min.js?v=5566f41afe61754de29348272d979319:3
XHR finished loading: GET "http://127.0.0.1:8000/api/config/common?_=1434976748857".rt.ajaxTransport.rt.support.cors.e.crossDomain.send @ main.min.js?v=5566f41afe61754de29348272d979319:3rt.extend.ajax @ main.min.js?v=5566f41afe61754de29348272d979319:3H @ main.min.js?v=5566f41afe61754de29348272d979319:9H @ main.min.js?v=5566f41afe61754de29348272d979319:9n.load @ main.min.js?v=5566f41afe61754de29348272d979319:12(anonymous function) @ main.min.js?v=5566f41afe61754de29348272d979319:28context.execCb @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1670Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:874(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1124(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:132(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1174each @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:57Module.emit @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1173Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:925Module.enable @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1161Module.init @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:782callGetModule @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1188context.completeLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1584context.onScriptLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1691
    main.min.js?v=5566f41afe61754de29348272d979319:3
XHR finished loading: GET "http://127.0.0.1:8000/api/config/notebook?_=1434976748856".rt.ajaxTransport.rt.support.cors.e.crossDomain.send @ main.min.js?v=5566f41afe61754de29348272d979319:3rt.extend.ajax @ main.min.js?v=5566f41afe61754de29348272d979319:3H @ main.min.js?v=5566f41afe61754de29348272d979319:9H @ main.min.js?v=5566f41afe61754de29348272d979319:9n.load @ main.min.js?v=5566f41afe61754de29348272d979319:12(anonymous function) @ main.min.js?v=5566f41afe61754de29348272d979319:28context.execCb @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1670Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:874(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1124(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:132(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1174each @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:57Module.emit @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1173Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:925Module.enable @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1161Module.init @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:782callGetModule @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1188context.completeLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1584context.onScriptLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1691
    main.min.js?v=5566f41afe61754de29348272d979319:3
XHR finished loading: GET "http://127.0.0.1:8000/api/kernelspecs".rt.ajaxTransport.rt.support.cors.e.crossDomain.send @ main.min.js?v=5566f41afe61754de29348272d979319:3rt.extend.ajax @ main.min.js?v=5566f41afe61754de29348272d979319:3H @ main.min.js?v=5566f41afe61754de29348272d979319:9H @ main.min.js?v=5566f41afe61754de29348272d979319:9o.request_kernelspecs @ main.min.js?v=5566f41afe61754de29348272d979319:27o @ main.min.js?v=5566f41afe61754de29348272d979319:27(anonymous function) @ main.min.js?v=5566f41afe61754de29348272d979319:28context.execCb @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1670Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:874(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1124(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:132(anonymous function) @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1174each @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:57Module.emit @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1173Module.check @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:925Module.enable @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1161Module.init @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:782callGetModule @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1188context.completeLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1584context.onScriptLoad @ require.js?v=4c293cc603dabc2eb7b3fd6e2e271ffa:1691
    cb=gapi.loaded_0:99
XHR finished loading: GET "https://content.googleapis.com/discovery/v1/apis/drive/v2/rest?fields=rootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods&pp=0".zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47
    cb=gapi.loaded_0:99 
XHR finished loading: GET "https://content.googleapis.com/drive/v2/files?q=title%20%3D%20%27Untitled0.ipynb%27%20and%20trashed%20%3D%20false%20%20and%20%27root%27%20in%20parents".zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47
    cb=gapi.loaded_0:99 
XHR finished loading: GET "https://content.googleapis.com/drive/v2/about".zu @ cb=gapi.loaded_0:99n @ cb=gapi.loaded_0:99Cu @ cb=gapi.loaded_0:99(anonymous function) @ cb=gapi.loaded_0:100g @ cb=gapi.loaded_0:56c @ cb=gapi.loaded_0:47
XHR finished loading: GET "https://doc-0o-94-docs.googleusercontent.com/docs/securesc/efp2reo7n1u0094i…922/0B_PdiYpBa5QmSldGb0w2RmhHakE?h=08712578529564101418&e=download&gd=true".
    main.min.js?v=5566f41afe61754de29348272d979319:24
Notebook failed to load from JSON: TypeError: Cannot read property 'language_info' of undefined
    at y.fromJSON (http://127.0.0.1:8000/static/notebook/js/main.min.js?v=5566f41afe61754de29348272d979319:24:10507)
    at y.load_notebook_success (http://127.0.0.1:8000/static/notebook/js/main.min.js?v=5566f41afe61754de29348272d979319:24:15947)
    at rt.extend.proxy.rt.isFunction.r (http://127.0.0.1:8000/static/notebook/js/main.min.js?v=5566f41afe61754de29348272d979319:1:16270)
    main.min.js?v=5566f41afe61754de29348272d979319:24
Uncaught (in promise) TypeError: Cannot read property 'orig_nbformat' of undefined
    at y.load_notebook_success (http://127.0.0.1:8000/static/notebook/js/main.min.js?v=5566f41afe61754de29348272d979319:24:16914)
    at rt.extend.proxy.rt.isFunction.r (http://127.0.0.1:8000/static/notebook/js/main.min.js?v=5566f41afe61754de29348272d979319:1:16270)

Hard refresh, relogin and cache cleaning aren't helping.

TypeError: install_nbextension() got an unexpected keyword argument 'user'

After creating a user profile with

ipython profile create colab

And running

python -m jupyterdrive colab

I am met with:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/neil/Projects/jupyter-drive/jupyterdrive/__main__.py", line 2, in <module>
    jupyterdrive.main()
  File "jupyterdrive/__init__.py", line 96, in main
    verbose=args.verbose
  File "jupyterdrive/__init__.py", line 31, in install
    nbextensions_dir=path)
TypeError: install_nbextension() got an unexpected keyword argument 'user'

mixed content Installation : configuration conflict with latest jupyter

Tring to unstall on a mac, with latest jupyter (at the time writing).
The command python3 -m jupyterdrive ends without error (still have to test it) while :

 python3 -m jupyterdrive --mixed

gives error :

python3 -m jupyterdrive --mixed
WARNING:root:Unrecognized JSON config file version, assuming version 1
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/src/jupyter-drive/jupyterdrive/__main__.py", line 2, in <module>
    jupyterdrive.main()
  File "/usr/local/src/jupyter-drive/jupyterdrive/__init__.py", line 161, in main
    verbose=args.verbose
  File "/usr/local/src/jupyter-drive/jupyterdrive/__init__.py", line 46, in install
    activate(profile, mixed=mixed)
  File "/usr/local/src/jupyter-drive/jupyterdrive/__init__.py", line 89, in activate
    return _activate(profile, mixed)
  File "/usr/local/src/jupyter-drive/jupyterdrive/__init__.py", line 99, in _activate
    raise ValueError('You already got some configuration that will conflict with google drive. Bailin out')
ValueError: You already got some configuration that will conflict with google drive. Bailin out

Ability to open files that haven't been created by the App

Because drive.file permission is being used, a file can only be opened if it has been created by the app, or opened with the App in either the Google Drive website, or using the FilePicker API.

Currently the FilePicker API won't work very well because it only allows one origin (e.g. 127.0.0.1:8888). Similarly opening a file from the Google Drive website will always redirect to 127.0.0.1:8888. Still, this is better than nothing.

Can't install with without access to /usr/local/share

This seems to be a problem with install_nbextension not our code. Is it possible that nb extensions aren't as compatible with virt_env as they should be? Or is it just that IPython don't want notebook extensions to be part of the virtual env?

MacBook Pro Installation Error

I've tried following the install instructions on two different laptops and have run into the same error each time.

First of all the Readme has a git command that doesn't work for me:

$ git clone git+git://github.com/jupyter/jupyter-drive.git
Cloning into 'jupyter-drive'...
fatal: Unable to find remote helper for 'git+git'

But I changed it so that it worked:

$ git clone git://github.com/jupyter/jupyter-drive.git
Cloning into 'jupyter-drive'...
remote: Counting objects: 858, done.
remote: Total 858 (delta 0), reused 0 (delta 0), pack-reused 858
Receiving objects: 100% (858/858), 388.24 KiB | 0 bytes/s, done.
Resolving deltas: 100% (463/463), done.
Checking connectivity... done.

pip installing seems to work:

$ pip install -e jupyter-drive
Obtaining file:///Users/jonathan/github/jupyter-drive
Requirement already satisfied (use --upgrade to upgrade): IPython in /Users/jonathan/anaconda/lib/python2.7/site-packages (from jupyterdrive==1.1.0)
Installing collected packages: jupyterdrive
  Running setup.py develop for jupyterdrive
Successfully installed jupyterdrive

This is the step that has the problems:

$ python -m jupyterdrive -v
No handlers could be found for logger "jupyterdrive"
Traceback (most recent call last):
  File "/Users/jonathan/anaconda/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/jonathan/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jonathan/github/jupyter-drive/jupyterdrive/__main__.py", line 2, in <module>
    jupyterdrive.main()
  File "/Users/jonathan/github/jupyter-drive/jupyterdrive/__init__.py", line 158, in main
    verbose=args.verbose
  File "/Users/jonathan/github/jupyter-drive/jupyterdrive/__init__.py", line 52, in install
    activate(profile, mixed=mixed)
  File "/Users/jonathan/github/jupyter-drive/jupyterdrive/__init__.py", line 91, in activate
    with jconfig(profile) as config:
  File "/Users/jonathan/github/jupyter-drive/jupyterdrive/__init__.py", line 70, in __enter__
    self.pdir = locate_profile(self.profile)
  File "/Users/jonathan/anaconda/lib/python2.7/site-packages/IPython/utils/path.py", line 357, in locate_profile
    pd = ProfileDir.find_profile_dir_by_name(get_ipython_dir(), profile)
  File "/Users/jonathan/anaconda/lib/python2.7/site-packages/IPython/core/profiledir.py", line 225, in find_profile_dir_by_name
    dirname = u'profile_' + name
TypeError: coercing to Unicode: need string or buffer, NoneType found

I've also run this giving it an IPython profile as well with the same error.

I'm running on a Mac Book Pro with the following information:

$ ipython
Python 2.7.9 |Anaconda 2.1.0 (x86_64)| (default, Dec 15 2014, 10:37:34)
Type "copyright", "credits" or "license" for more information.

IPython 3.1.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

CLIENT_ID not getting picked up from <profiledir>/nbconfig/common.json?

The advanced config section of the README.md says that the file nbconfig/common.json will get picked up ... it's not getting picked up. Could be user error.

For now, I'm manually overriding in the code which isn't ideal.

$ pwd
/home/virtualirfan/.ipython
$ ls -l
total 16
drwxr-xr-x 2 virtualirfan virtualirfan 4096 Mar  1 23:50 extensions
drwxr-xr-x 2 virtualirfan virtualirfan 4096 Mar  1 23:50 nbextensions
drwxr-xr-x 9 virtualirfan virtualirfan 4096 Mar  3 03:49 profile_default
-rw-r--r-- 1 virtualirfan virtualirfan  195 Mar  1 23:50 README
$ cd profile_default/
$ ls
db  history.sqlite  ipython_notebook_config.json  log  nbconfig  pid  security  startup  static
$ cat ipython_notebook_config.json
{
  "MixedContentsManager": {
    "filesystem_scheme": [
      {
        "contents": "IPython.html.services.contents.filemanager.FileContentsManager",
        "root": "local"
      },
      {
        "contents": "jupyterdrive.clientsidenbmanager.ClientSideContentsManager",
        "root": "gdrive"
      }
    ]
  },
  "NotebookApp": {
    "tornado_settings": {
      "contents_js_source": "nbextensions/gdrive/mixed-contents"
    },
    "contents_manager_class": "jupyterdrive.mixednbmanager.MixedContentsManager"
  },
  "nbformat": 1
}
$ cat nbconfig/common.json
{
"gdrive":
    {
    "METADATA_SCOPE": true,
    "FILE_SCOPE": true,
    "CLIENT_ID": "<ELIDED>"
    },
"mixed_contents":
    {
    "schema": [
      {
        "stripjs": false,
        "contents": "services/contents",
        "root": "local"
      },
      {
        "stripjs": true,
        "contents": "./drive-contents",
        "root": "gdrive"
      }
    ]
  }
}

Delete API

Works! Thanks for the fix. Btw there seems to be an API change (or a bug in mixed contents on the python side) where "delete" doesn't return anything, even though the JS side expects a file model.

from #91

Daily Limit for Unauthenticated Use Exceeded. Continue use requires signup.

After long edit i ever receive that message and i can't save my notebook!

image

Details | Comment

I using mixed content configuration. After that message, if I close my notebook and open again, I can save him! I use linux and I don't have a good client for sync — actually, now I using grive but I have some bugs with shared folders (and the notebooks are shared). So the best way to save my notebooks would be jupyter-drive, however, I have suffering with that behavior! 😢

Help

Somebody knows the reason for that? Because I really already sign in with my account. It's weird. I think that tool is very cool... i don't for sure if the bug is with jupyter-drive or instead some configuration mine.

Anyway, thanks for the tool, it's really useful (perhaps I guess would have better docs for installation)

gapi_ready question.

I want gapi_ready to resolve only once things are loaded, and a specific config() (or named otherwise) methods is called so that .then(authenticate) can get access to a config object.

Though I cannot find a way how to make it work with Promise.all.

Any pointer ? Or should I just change the api a lot ?

Working checkpointing

Currently checkpointing can create checkpoints, but checkpoints don't display properly and restore is buggy.

gapi revoke some scope ?

Is there a way to "revoke" some scope without having to drop all token and having to re-authorize the all thing ?

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.