Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into user-creation
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh1 committed Jun 4, 2018
2 parents 64507bb + ce0b3fa commit 2e93199
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
23 changes: 16 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
==============
girder_jupyter
==============
|build-status|
|build-status| |pypi-version| |pypi-status|

The Jupyter Notebook web application provides a graphical interface for creating, opening, renaming, and deleting files in a virtual filesystem. girder_jupyter is a python package that implements a `contents manager <http://jupyter-notebook.readthedocs.io/en/latest/extending/contents.html>`_
to allow Girder to become a backend for this virtual filesystem. This allows notebooks and files to be stored
Expand All @@ -21,25 +21,34 @@ Add the following options to your :code:`jupyter_notebook_config.py`

.. code-block:: python
c.NotebookApp.contents_manager_class = 'girder_jupyter.contents.girderfilemanager.GirderFileManager'
c.GirderFileManager.api_key = '<api key>'
c.GirderFileManager.api_url = '<api url>'
c.NotebookApp.contents_manager_class = 'girder_jupyter.contents.manager.GirderContentsManager'
c.GirderContentsManager.api_key = '<api key>'
c.GirderContentsManager.api_url = '<api url>'
Where :code:`<api key>` is replaced with a `Girder API key <https://girder.readthedocs.io/en/latest/user-guide.html?highlight=API%20Key#api-keys>`_ for the Girder server and :code:`<api url>` is the URL to Girder instance you want
Where :code:`<api key>` is replaced with a `Girder API key <https://girder.readthedocs.io/en/latest/user-guide.html?highlight=API%20Key#api-keys>`__ for the Girder server and :code:`<api url>` is the URL to Girder instance you want
to use for example http://localhost:8080/api/v1.

Configuration Parameters
========================

- :code:`api_url` - An API URL for the Girder server. Defaults to 'http://localhost:8080/api/v1'
- :code:`api_key` -A `Girder API key <https://girder.readthedocs.io/en/latest/user-guide.html?highlight=API%20Key#api-keys>`_ key for the Girder server at :code:`api_url`. The key should have read and write permission scope.
- :code:`api_key` -A `Girder API key <https://girder.readthedocs.io/en/latest/user-guide.html?highlight=API%20Key#api-keys>`__ key for the Girder server at :code:`api_url`. The key should have read and write permission scope.
- :code:`token` - A Girder token for the Girder server at :code:`api_url`. This parameter is particularly useful when running instances from JupyterHub.
- :code:`root` - The root in the Girder hierarchy to use as the content managers root. This path can
include :code:`{login}` which will be replace with the current users login. Defaults to :code:`'user/{login}'`
include :code:`{login}` which will be replace with the current users login. Defaults to :code:`'user/{login}'`

Note that either :code:`api_key` or :code:`token` must be provided for the contents manager to be able to
authenticate with the Girder server.

.. |build-status| image:: https://circleci.com/gh/girder/girder_jupyter.png?style=shield
:target: https://circleci.com/gh/girder/girder_jupyter
:alt: Build Status

.. |pypi-version| image:: https://img.shields.io/pypi/v/girder-jupyter.svg
:target: https://pypi.python.org/pypi/girder-jupyter/
:alt: PyPI version

.. |pypi-status| image:: https://img.shields.io/pypi/status/girder-jupyter.svg
:target: https://pypi.python.org/pypi/girder-jupyter/
:alt: PyPI status

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import girder_client


class GirderFileManager(ContentsManager):
class GirderContentsManager(ContentsManager):

api_url = Unicode(
allow_none=True,
Expand Down Expand Up @@ -83,7 +83,7 @@ def _render_login(self, root):
return root

def __init__(self, *args, **kwargs):
super(GirderFileManager, self).__init__(*args, **kwargs)
super(GirderContentsManager, self).__init__(*args, **kwargs)
# Render {login}
self.root = self._render_login(self.root)

Expand Down
8 changes: 4 additions & 4 deletions tests/test_girder_contents_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ def setup_class(cls):
cls.config = Config()
cls.config.NotebookApp.ip = '127.0.0.1'
cls.config.NotebookApp.contents_manager_class =\
'girder_jupyter.contents.girderfilemanager.GirderFileManager'
'girder_jupyter.contents.manager.GirderContentsManager'

if 'GIRDER_API_KEY' in os.environ:
api_key = os.environ['GIRDER_API_KEY']
cls.config.GirderFileManager.api_key = api_key
cls.config.GirderContentsManager.api_key = api_key
cls.gc.authenticate(apiKey=api_key)
elif 'GIRDER_USER' in os.environ and 'GIRDER_PASSWORD' in os.environ:
user = os.environ['GIRDER_USER']
password = os.environ['GIRDER_PASSWORD']
cls.gc.authenticate(user, password)
cls.config.GirderFileManager.token = cls.gc.token
cls.config.GirderContentsManager.token = cls.gc.token
else:
raise Exception('No Girder credentials configured.')

cls.config.GirderFileManager.root = 'user/{login}/Private'
cls.config.GirderContentsManager.root = 'user/{login}/Private'
cls.user = cls.gc.get('user/me')
super(APITest, cls).setup_class()

Expand Down

0 comments on commit 2e93199

Please sign in to comment.