Commit be66df0a authored by vermeul's avatar vermeul
Browse files

Merge branch 'release/0.4.0'

parents 5019bf8a 81671560
## jupyter-openbis-server 0.4.0
- added jupyter-openbis-conn utility to create a connection file
- made server compatible with Jupyter Lab 3.0
## jupyter-openbis-server 0.3.0
- removed fixed tornado version (5.1.1) to make it compatible with jupyter lab
......@@ -6,5 +6,5 @@ include LICENSE
# Include all files
recursive-include jupyter-openbis-server *.py
recursive-include openbis_connection *.py
recursive-include jupyter-config *.json
......@@ -9,13 +9,51 @@ This extension has been successfully tested with Safari 12.0.3, Chrome 72.0 and
The server extension will be automatically installed when you install the Jupyter Notebook Extension (the «classic» Jupyter Notebook):
pip install --upgrade jupyter-openbis-extension
$ pip install --upgrade jupyter-openbis-extension
If you need to install or upgrade the server extension alone, you can do so by:
pip install --upgrade jupyter-openbis-server
$ pip install --upgrade jupyter-openbis-server
Make sure your extension is recognised by Jupyter and enabled (your output may vary, but ensure you see the line: `jupyter-openbis-server.main OK`)
$ jupyter serverextension list
config dir: /Users/your_username/.pyenv/versions/3.6.9/etc/jupyter
jupyter-openbis-server.main enabled
- Validating...
jupyter-openbis-server.main OK
## Create a connection configuration file
When the module is installed, you can create a connection configuration file.
$ jupyter-openbis-conn --help
Usage: jupyter-openbis [OPTIONS]
Generate an openBIS connection file for use in Jupyter notebooks.
-n, --name TEXT
-h, --hostname TEXT
--verfiy / --no-verify
--https / --no-https
-u, --username TEXT
-p, --password TEXT
-d, --destination [/Users/your_username/.jupyter|/Users/your_username/.pyenv/versions/3.6.9/etc/jupyter|/usr/local/etc/jupyter|/etc/your_username]
[default: /Users/your_username/.jupyter]
--help Show this message and exit.
You can start the utility as-is to get prompted for every parameter. Username and password are optional.
$ jupyter-openbis-conn
## install Jupyter extension manually
name = 'jupyter-openbis-server.server'
__author__ = 'Swen Vermeul'
__email__ = ''
__version__ = '0.3.0'
__version__ = '0.4.0'
def _jupyter_server_extension_paths():
return [{
......@@ -157,3 +157,6 @@ def load_jupyter_server_extension(nb_server_app):
_load_jupyter_server_extension = load_jupyter_server_extension
import click
import yaml
import pathlib
from notebook import notebookapp
filepaths = notebookapp.jupyter_config_path()
@click.option('--name', '-n', prompt="Name of the connection")
@click.option('--hostname', '-h', prompt="Hostname of your openBIS instance")
@click.option('--verfiy/--no-verify', default=True, prompt="Verify server certificate")
@click.option('--https/--no-https', default=True, prompt="Use secure connection?")
@click.option('--username', '-u', default='', prompt="Username to connect to the openBIS instance")
@click.option('--password', '-p', default='', prompt="Password to connect to the openBIS instance")
@click.option('--destination', '-d', type=click.Choice(filepaths), show_default=True, default=filepaths[0], prompt="Destination where you want to store the configuration")
def cli(ctx, name=None, hostname=None, verfiy=True, https=True, username=None, password=None, destination=None):
"""Generate an openBIS connection file for use in Jupyter notebooks.
config_filepath = pathlib.Path(destination) / 'openbis-connections.yaml'
if config_filepath.exists():
if not click.confirm(f"A configuration file already exists in {config_filepath}. Do you want to overwrite?"):
connection = {
"name" : name,
"url" : hostname,
"verify_certificates" : verfiy,
if username: connection['username'] = username
if password: connection['password'] = password
if not https: connection['http_only'] = True
template = {}
template['connections'] = [connection]
yaml_object = yaml.dump(template)
with open(config_filepath, "w") as outfile:
print(f"sample openBIS connection file written to {config_filepath}")
if __name__ == '__main__':
......@@ -11,16 +11,18 @@ with open("", "r", encoding="utf-8") as fh:
version= '0.3.0',
version= '0.4.0',
author='Swen Vermeul | ID SIS | ETH Zürich',
description='Server Extension for Jupyter notebooks to connect to openBIS and download/upload datasets, inluding the notebook itself',
packages=['jupyter-openbis-server', 'openbis_connection'],
license='Apache Software License Version 2.0',
......@@ -37,9 +39,19 @@ setup(
# like `jupyter serverextension enable --sys-prefix`
("etc/jupyter/jupyter_notebook_config.d", [
'console_scripts' : [
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment