Skip to content
Snippets Groups Projects
Commit 38fc353e authored by Swen Vermeul's avatar Swen Vermeul
Browse files

Merge branch 'release/0.2.0'

parents c719f0aa 7ffe765f
No related branches found
Tags 0.2.0
No related merge requests found
# Convert README.md markdown to README.rst reStructuredText
pandoc --from=markdown --to=rst --output=README.rst README.md
# create a source-distribution
python setup.py sdist
# see distributions
ls -la dist/
# upload distribution(s) to pypi
twine upload dist/*
...@@ -6,25 +6,6 @@ The jupyter-openbis-extension needs at least **Python 3.3** in order to run. The ...@@ -6,25 +6,6 @@ The jupyter-openbis-extension needs at least **Python 3.3** in order to run. The
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. 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.
## Development with Vagrant
If you want to use a predefined development environment, follow these steps:
1. Install latest version of VirtualBox (<https://www.virtualbox.org>)
2. Install latest version of Vagrant (<https://www.vagrantup.com/downloads.html>)
3. vagrant plugin install vagrant-vbguest vagrant-notify-forwarder vagrant-disksize
4. cd vagrant
5. vagrant up
After the setup is complete, you'll have
* Jupyter with openBIS extension running at <http://localhost:8888>.
* openBIS running at <http://localhost:8122>, with credentials admin/password.
* Experiment /DEFAULT/DEFAULT with a lot of datasets for testing.
## Install the extension ## Install the extension
...@@ -34,43 +15,10 @@ If you haven't done yet: download the latest jupyter-openbis-extension from pip. ...@@ -34,43 +15,10 @@ If you haven't done yet: download the latest jupyter-openbis-extension from pip.
pip install --upgrade jupyter-openbis-extension pip install --upgrade jupyter-openbis-extension
``` ```
or, if you would like to develop: ## Create a configuration file
```
$ 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 .
(venv) $ jupyter serverextension enable --py jupyter-openbis-extension
(venv) $ jupyter nbextension install --py jupyter-openbis-extension --user --symlink
(venv) $ jupyter nbextension enable jupyter-openbis-extension --user --py
```
**Register the Jupyter server extension** which will communicate both with openBIS and the notebook:
```
jupyter serverextension enable --py jupyter-openbis-extension
```
**Register the notebook extension**, the client side of the Jupyter notebook, which will communicate with the server extension via AJAX calls:
```
jupyter nbextension install --py jupyter-openbis-extension --user
```
If you are developing, you should consider creating a link to the JavaScript source instead:
```
jupyter nbextension install --py jupyter-openbis-extension --user --symlink
```
Finally, activate the notebook extension. 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:
```
jupyter nbextension enable jupyter-openbis-extension --user --py
```
**Create a configuration file**: `~/.jupyter/openbis-connections.yaml` It should contain connection information to your server(s), for example:
``` ```
connections: connections:
...@@ -83,11 +31,10 @@ connections: ...@@ -83,11 +31,10 @@ connections:
url : https://openbis.example.com url : https://openbis.example.com
verify_certificates : true verify_certificates : true
username : username username : username
password : password
``` ```
**Note 1**: You do not need the usernames or passwords anymore. With the current version, you are able to enter username and password directly from within a Jupyter notebook. **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**: You can place this file in any of these directories (on Mac OS X): **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-openbis-extension/notebooks
...@@ -96,102 +43,77 @@ connections: ...@@ -96,102 +43,77 @@ connections:
/usr/local/etc/jupyter /usr/local/etc/jupyter
/etc/jupyter /etc/jupyter
``` ```
These directories are produced by Jupyters' `nb_server_app.config_file_paths` method. 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.
## Launching Jupyter notebook ## Launching Jupyter notebook
Now you are **ready to launch jupyter notebook!** Now you are ready to launch Jupyter notebook:
``` ```
$ jupyter notebook $ jupyter notebook --no-browser
``` ```
Observe the terminal. It should tell you which server(s) have been successfully connected (and which not): 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 $ jupyter notebook
Registered: https://localhost:8443 Registered: https://localhost:8443
Cannot establish connection to: https://localhost:8443 Successfully connected to: https://localhost:8443
Registered: https://openbis.example.com Registered: https://openbis.example.com
Successfully connected to: https://openbis.example.com
``` ```
**Congratulations!** You can retry non-successful connections later, directly from the GUI. **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 ## Uninstall Jupyter extension
``` ```
jupyter serverextension disable --py jupyter-openbis-extension $ jupyter serverextension disable --py jupyter-openbis-extension
jupyter nbextension disable --py jupyter-openbis-extension --user $ jupyter nbextension disable --py jupyter-openbis-extension --user
jupyter nbextension uninstall --py jupyter-openbis-extension --user $ jupyter nbextension uninstall --py jupyter-openbis-extension --user
``` ```
This should remove the registrations in `~/.jupyter/jupyter_notebook_config.json` and `~/.jupyter/nbconfig/notebook.json`. The symbolic link in `~/Library/Jupyter/nbextension/` (Mac OS X) should have been removed too. If not, you can remove it manually. This should remove the registrations in the paths listed by the
## Manual installation (if above should fail)
### Install the Python module(s)
- clone the project:
``` ```
git clone git@sissource.ethz.ch:sispub/jupyter-openbis-extension.git $ jupyter --paths
``` ```
- cd into the extension `cd jupyter-openbis-extension` command.
- install the python module normally: `pip install .`
- or, for development, install just a symbolic link: `pip install -e .`
- this extension needs Jupyter and pyBIS 1.7.2 in order to run, so it will load / upgrade it if not yet present
- the jupyter-openbis-extension needs at least Python 3.3 in order to run. Therefore, your Jupyter notebook server (but not the kernel!) needs to run under at least Python 3.3 too.
### Register the Jupyter Notebook Server Extension (server-side, as the name suggests)
- in the terminal, enter the following:
`` ## Development with Vagrant
jupyter serverextension enable --py jupyter-openbis-extension
``
- OR (1) register it manually: If you want to use a predefined development environment, follow these steps:
- open the file `~/.jupyter/jupyter_notebook_config.py`
- add the following:
``` 1. Install latest version of VirtualBox (<https://www.virtualbox.org>)
c.NotebookApp.server_extensions = [
'jupyter-openbis-extension.server'
]
```
- OR (2) register it in `~/.jupyter/jupyter_notebook_config.json` manually, if the automatic registration fails for some reasons: 2. Install latest version of Vagrant (<https://www.vagrantup.com/downloads.html>)
```
{
"NotebookApp": {
"nbserver_extensions": {
"jupyter-openbis-extension.server": true
}
}
}
```
### Register the Jupyter Notebook Extension (client-side) 3. vagrant plugin install vagrant-vbguest vagrant-notify-forwarder vagrant-disksize
4. cd vagrant
Inside the folder `~/Library/Jupyter/nbextension/` (Mac OS X) create a symbolic **link to the folder that contains the Java Script**: 5. vagrant up
``` After the setup is complete, you'll have
ln -s /path/to/jupyter-openbis-extension/nbextension/dialog.js jupyter-openbis-extension
```
In the file `~/.jupyter/nbconfig/notebook.json` the JavaScript gets activated like this:
``` * Jupyter with openBIS extension running at <http://localhost:8888>.
{ * openBIS running at <http://localhost:8122>, with credentials admin/password.
"load_extensions": { * Experiment /DEFAULT/DEFAULT with a lot of datasets for testing.
"jupyter-openbis-extension/dialog": true
}
} ### clone repository and install extension for development
```
**Check** that the nbextension has been installed and activated:
``` ```
$ jupyter nbextension list $ git clone git@sissource.ethz.ch:sispub/jupyter-openbis-extension.git
Known nbextensions: $ cd jupyter-openbis-extension
config dir: /Users/your-username/.jupyter/nbconfig $ virtualenv venv
notebook section $ source venv/bin/activate
jupyter-openbis-extension/dialog enabled (venv) $ pip install -e .
- Validating: OK
``` ```
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](https://jupyter-notebook.readthedocs.io/en/stable/extending/index.html). To distribute Jupyter Extensions, read this [documentation](https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#) carefully.
\ No newline at end of file
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.
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.
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:
1. Install latest version of VirtualBox (https://www.virtualbox.org)
2. Install latest version of Vagrant
(https://www.vagrantup.com/downloads.html)
3. vagrant plugin install vagrant-vbguest vagrant-notify-forwarder
vagrant-disksize
4. cd vagrant
5. vagrant up
After the setup is complete, you'll have
- Jupyter with openBIS extension running at http://localhost:8888.
- openBIS running at http://localhost:8122, with credentials
admin/password.
- Experiment /DEFAULT/DEFAULT with a lot of datasets for testing.
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 <https://jupyter-notebook.readthedocs.io/en/stable/extending/index.html>`__.
To distribute Jupyter Extensions, read this
`documentation <https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html#>`__
carefully.
# Installing the extension manually
**Register the Jupyter server extension** which will communicate both with openBIS and the notebook:
```
jupyter serverextension enable --py jupyter-openbis-extension
```
**Register the notebook extension**, the client side of the Jupyter notebook, which will communicate with the server extension via AJAX calls:
```
jupyter nbextension install --py jupyter-openbis-extension --user
```
If you are developing, you should consider creating a link to the JavaScript source instead:
```
jupyter nbextension install --py jupyter-openbis-extension --user --symlink
```
Finally, activate the notebook extension.
```
jupyter nbextension enable jupyter-openbis-extension --user --py
```
## Manual installation (if above should fail)
### Install the Python module(s)
- clone the project:
```
git clone git@sissource.ethz.ch:sispub/jupyter-openbis-extension.git
```
- cd into the extension `cd jupyter-openbis-extension`
- install the python module normally: `pip install .`
- or, for development, install just a symbolic link: `pip install -e .`
- this extension needs Jupyter and pyBIS 1.7.2 in order to run, so it will load / upgrade it if not yet present
- the jupyter-openbis-extension needs at least Python 3.3 in order to run. Therefore, your Jupyter notebook server (but not the kernel!) needs to run under at least Python 3.3 too.
### Register the Jupyter Notebook Server Extension (server-side, as the name suggests)
- in the terminal, enter the following:
``
jupyter serverextension enable --py jupyter-openbis-extension
``
- OR (1) register it manually:
- open the file `~/.jupyter/jupyter_notebook_config.py`
- add the following:
```
c.NotebookApp.server_extensions = [
'jupyter-openbis-extension.server'
]
```
- OR (2) register it in `~/.jupyter/jupyter_notebook_config.json` manually, if the automatic registration fails for some reasons:
```
{
"NotebookApp": {
"nbserver_extensions": {
"jupyter-openbis-extension.server": true
}
}
}
```
### Register the Jupyter Notebook Extension (client-side)
Inside the folder `~/Library/Jupyter/nbextension/` (Mac OS X) create a symbolic **link to the folder that contains the Java Script**:
```
ln -s /path/to/jupyter-openbis-extension/nbextension/dialog.js jupyter-openbis-extension
```
In the file `~/.jupyter/nbconfig/notebook.json` the JavaScript gets activated like this:
```
{
"load_extensions": {
"jupyter-openbis-extension/dialog": true
}
}
```
**Check** that the nbextension has been installed and activated:
```
$ jupyter nbextension list
Known nbextensions:
config dir: /Users/your-username/.jupyter/nbconfig
notebook section
jupyter-openbis-extension/dialog enabled
- Validating: OK
```
name = 'jupyter-openbis-extension.server' name = 'jupyter-openbis-extension.server'
__author__ = 'Swen Vermeul' __author__ = 'Swen Vermeul'
__email__ = 'swen@ethz.ch' __email__ = 'swen@ethz.ch'
__version__ = '0.1.1' __version__ = '0.2.0'
def _jupyter_server_extension_paths(): def _jupyter_server_extension_paths():
return [{ return [{
......
...@@ -2,8 +2,7 @@ connections: ...@@ -2,8 +2,7 @@ connections:
- name: local test openBIS instance - name: local test openBIS instance
url: https://localhost:8443 url: https://localhost:8443
verify_certificates: false verify_certificates: false
username: username username: admin
password: password
- name: vagrant openBIS instance - name: vagrant openBIS instance
url: https://localhost:8122 url: https://localhost:8122
verify_certificates: false verify_certificates: false
......
...@@ -11,7 +11,7 @@ with open("README.md", "r", encoding="utf-8") as fh: ...@@ -11,7 +11,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setup( setup(
name='jupyter-openbis-extension', name='jupyter-openbis-extension',
version= '0.1.1', version= '0.2.0',
author='Swen Vermeul | ID SIS | ETH Zürich', author='Swen Vermeul | ID SIS | ETH Zürich',
author_email='swen@ethz.ch', author_email='swen@ethz.ch',
description='Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself', description='Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment