Skip to content
Snippets Groups Projects
Commit 680f424c authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-1365: Add and configure jupyterlab-git plugin

parent c467ea93
No related branches found
No related tags found
1 merge request!609L2SS-1365: Add and configure jupyterlab-git plugin
Showing
with 214 additions and 196 deletions
......@@ -15,7 +15,7 @@ version: '2.1'
services:
jupyter-lab:
build:
context: jupyterlab
context: jupyter-lab
args:
CONTAINER_EXECUTION_UID: ${CONTAINER_EXECUTION_UID}
SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION}
......
......@@ -60,5 +60,10 @@ USER ${CONTAINER_EXECUTION_UID}
# pyppeteer-install installs in the homedir, so run it as the user that will execute the notebook
RUN pyppeteer-install
# Configure using git from Jupyter Lab. Since the web service is open, we can't know who is
# committing. We thus tie commits to this machine instead of to the user.
RUN git config --global user.email "jupyterlab-${HOSTNAME}@lofar.eu"
RUN git config --global user.name "JupyterLab on ${HOSTNAME}"
# Enable Jupyter lab
ENV JUPYTER_ENABLE_LAB=yes
......@@ -14,9 +14,11 @@ from notebook.notebookapp import main
from logstash_async.handler import AsynchronousLogstashHandler, LogstashFormatter
import logging
if __name__ == '__main__':
if __name__ == "__main__":
# log to the tcp_input of logstash in our logstash-loki container
handler = AsynchronousLogstashHandler("logstash", 5959, database_path='/tmp/pending_log_messages.db')
handler = AsynchronousLogstashHandler(
"logstash", 5959, database_path="/tmp/pending_log_messages.db"
)
# add to logger of Jupyter traitlets Application. As that logger is configured not to propagate
# messages upward, we need to configure it directly.
......@@ -24,5 +26,5 @@ if __name__ == '__main__':
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(main())
ipython >=7.27.0,!=7.28.0 # BSD
jupyter
jupyterlab
jupyterlab >=3,<4 # until https://github.com/jupyterlab/jupyterlab-git/issues/1245
jupyterlab_h5web[full] # MIT
jupyterlab-git
ipykernel
jupyter_bokeh
matplotlib
......
......@@ -12,7 +12,7 @@ The station offers Jupyter Lab On http://localhost:8888, which allow one to inte
The notebooks provide some predefined variables, so you don't have to look them up:
.. literalinclude:: ../../../../docker-compose/jupyterlab/ipython-profiles/stationcontrol-jupyter/startup/01-devices.py
.. literalinclude:: ../../../../docker-compose/jupyter-lab/ipython-profiles/stationcontrol-jupyter/startup/01-devices.py
Note: the Jupyter notebooks use enhancements from the ``itango`` suite, which provide tab completions, but also the ``Device`` alias for ``DeviceProxy`` as was used in the Python examples in the next section.
......@@ -24,6 +24,16 @@ You can also use Jupyter Labs integrated console to run your commands (File->New
.. image:: jupyter_console_basic_example.png
Jupyter Lab and Git
------------------------
We provide the ability to interact with git repositories by including the `jupyter-git <https://github.com/jupyterlab/jupyterlab-git>`_ plugin. See their webpage for how to use this plugin.
In our installation, all git commits will be made as a fictive ``JupyterLab on $HOSTNAME`` user. This is because JupyterLab does not know who the user is, and it's preferred to explicitly state at least where the commit comes from, rather than under the name of the last person who told git who they are.
Any problems encountered in git that cannot be solved through the plugin, can be solved by spawning a Terminal and using the ``git`` command-line interface.
.. _pytango-section:
PyTango
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment