Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself
Project description
Jupyter-OpenBIS-Extension
Requirements
The jupyter-openbis-extension needs at least Python 3.3 in order to run. The Jupyter notebook server starts this extension during startup and must therefore run under the same Python version. The kernel can be anything (Python 2.7, Julia, R, Perl...)
This extension has been successfully tested with Safari 12.0.3, Chrome 72.0 and Firefox 66.0. There is a known incompatibility before Firefox 61.0b13 with Tornado > 6.x (the webserver used by Jupyter). If you encounter such incompatibilities, try to downgrade to Tornado 5.1.1. However, Tornado 5.1.1 will not work with Jupyter Lab 3.
Install the extension
If you haven't done yet: download the latest jupyter-openbis-extension from pip. It will automatically install the various dependencies, e.g. Pandas and NumPy.
pip install --upgrade jupyter-openbis-extension
Create a configuration file
This step is not really necessary, as you can define openBIS connections within the Jupyter notebook. However, if you need to connect to the same openBIS connections many times, this will become convenient.
Create a file openbis-connections.yaml
. It should contain connection information to your server(s), for example:
connections:
- name : TEST local openBIS instance
url : https://localhost:8443
verify_certificates : false
username : username
password : password
- name : PRODUCTION openBIS instance
url : https://openbis.example.com
verify_certificates : true
username : username
Note 1: You do not need neither username nor password. With the current version, you are able to enter username and password directly from within a Jupyter notebook.
Note 2: Place this file in any of these directories (on Mac OS X):
/Users/your_username/jupyter-openbis-extension/notebooks
/Users/your_username/.jupyter
/Users/your_username/.pyenv/versions/3.6.0/etc/jupyter # or wherever your jupyter installation is located
/usr/local/etc/jupyter
/etc/jupyter
These directories can be found by invoking
$ jupyter --paths
The config
section from the output lists the directories where your openbis-connections.yaml
file should be placed.
install Jupyter extension manually
In most cases, a simple pip install --upgrade jupyter-openbis-extension
will do. However, in some cases you need to issue the following commands to get the extension running correctly:
$ jupyter serverextension enable --py jupyter-openbis-extension
$ jupyter nbextension install --py jupyter-openbis-extension --user
$ jupyter nbextension enable --py jupyter-openbis-extension --user
If you want to install the extension globally, use --system
instead of --user
.
Launching Jupyter notebook
Now you are ready to launch Jupyter notebook:
$ jupyter notebook --no-browser
Observe the terminal. It should tell you which server(s) have been registered. If you provided a password, it will try to connect:
$ jupyter notebook
Registered: https://localhost:8443
Successfully connected to: https://localhost:8443
Registered: https://openbis.example.com
Congratulations! You can retry non-successful connections later, directly from the GUI. Copy the the URL given in the output and paste it in your browser. You might also just start Jupyter without the --no-browser
option.
Uninstall Jupyter extension
$ jupyter serverextension disable --py jupyter-openbis-extension
$ jupyter nbextension disable --py jupyter-openbis-extension --user
$ jupyter nbextension uninstall --py jupyter-openbis-extension --user
This should remove the registrations in the paths listed by the
$ jupyter --paths
command.
Development with Vagrant
If you want to use a predefined development environment, follow these steps:
-
Install latest version of VirtualBox (https://www.virtualbox.org)
-
Install latest version of Vagrant (https://www.vagrantup.com/downloads.html)
-
vagrant plugin install vagrant-vbguest vagrant-notify-forwarder vagrant-disksize
-
cd vagrant
-
vagrant up
After the setup is complete, you'll have
- Jupyter with openBIS extension running at http://localhost:8888.
- openBIS running at https://localhost:8122/openbis/, with credentials admin/password.
- Object /DEFAULT/DEFAULT with a lot of datasets for testing.
Hint: Jupyter creates no log file. Everything is printed onto the console. In order to see this output do the following:
- vagrant ssh
- screen -r
You can escape from the screen by typing ^A followed by ^D.
clone repository and install extension for development
$ git clone git@sissource.ethz.ch:sispub/jupyter-openbis-extension.git
$ cd jupyter-openbis-extension
$ virtualenv venv
$ source venv/bin/activate
(venv) $ pip install -e .
The -e
is a shortcut for --editable
. This means, it will only establish a link to your source folder instead of copying the files. When you do any modifications on the jupyter server extension (the Python files) you need to restart Jupyter notebook in order to see the changes.
If you make modifications on the UI (the Javascript files) you only need to reload the page in order the see the effect.
How to extend Jupyter Notebooks is described here. To distribute Jupyter Extensions, read this documentation carefully.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file jupyter-openbis-extension-0.6.0.tar.gz
.
File metadata
- Download URL: jupyter-openbis-extension-0.6.0.tar.gz
- Upload date:
- Size: 165.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b221182a7228f7b3a5d831d25488ba2257d9b1814d9d49ac5d78eee42a7e3856 |
|
MD5 | e60f5253931c18750a24f611991f8f10 |
|
BLAKE2b-256 | c896dd589b5d106e8c4e25aeace6f37b52f0f1d0464c507a36ad67fe072d2d68 |