Skip to main content

Posts

Showing posts from May, 2021

Conda environment to be used as Jupyterlab kernel across users

When trying to set up our own Jupyterlab server where general users can visit and use, the link in Ref. [1] could be followed. Once we follow literally the step-1 specified in the link, the server should be running without problem and we can just start using our own online Jupyterlab service. However, since the Jupyterlab service we just set up is a system-wise available service and therefore when we want to add kernels to the Jupyterlab service, we cannot use those kernels belonging to a specific user. Instead, we should set up system-wise available environment which then can be used as system-wise available kernels. The step-2 in Ref. [1] provides us with a generic way to set up the system-wise available environment using conda . Definitely we can follow the instructions there to set up conda in such way that conda itself is also system-wise available. As an alternative, we can be a bit flexible - we can use general users' local conda environment to do this as well, as long as

Documentation with docstrings in Python

Docstring is part of Python script which will keep record of documentation and description of the relevant section in the script. It won't make any effect upon the execution of the script but whenever needed, the docstring could be pulled out and displayed for users' reference. Based on that, we can go further to generate dedicated documentation pages/docs for general purpose. At this point, Sphinx is a commonly used package to transform the docstrings in Python script into either HTML, LaTeX or some other suitable formats. Here in this blog, I am going to write down some notes in using Sphinx for building documentation based on the docstring in Python scripts. The steps below could be used as sort of general guidance to set things up with Sphinx. 1. Installation The official link to Sphinx gives rather detailed instructions about the installation and here I am not going to reproduce those details - refer to Ref. [1]. 2. Initial setup Once Sphinx is installed, we may want to se