Skip to main content

Getting started

Getting the code

If you are using git, you can clone the project by:

git clone https://github.com/pranabdas/suvtools.git

You can also download the ZIP archive of the package here.

Requirements

You will need Python 3 and following python packages installed:

pip3 install numpy matplotlib scipy pandas

Alternatively, you can install the packages using requirements.txt:

pip3 install --upgrade -r requirements.txt

Importing suvtools modules into your program:

If the suvtools directory is inside your project directory, you can import using:

import suvtools as suv

Later we can refer to the modules as suv. (e.g., suv.load).

If the suvtools directory is placed outside project directory, we can import using:

import sys
sys.path.append("/parent/suvtools/path/")
import suvtools as suv
info

If you are new to python programming, you can check out my python tutorial.

Run suvtools along with Jupyter notebook in Docker:

Here is a sample dockerfile. You can adjust according to your needs:

Dockerfile
# Start from Ubuntu 22.04 LTS
FROM ubuntu:jammy

# Update OS
RUN apt update && apt upgrade -y

# Install software packages
RUN apt install -y python3 python3-pip

# Install pip packages
RUN pip3 install jupyterlab numpy scipy matplotlib pandas

# jupyterlab settings
RUN mkdir /etc/jupyter && \
(echo "c.ServerApp.ip = '0.0.0.0'" && \
echo "c.ServerApp.allow_root = True" && \
echo "c.ServerApp.open_browser = False") \
>> /etc/jupyter/jupyter_server_config.py

# leave in `/home` which we can map with the host
WORKDIR /home

Build the Docker image:

docker build -t suvtools .

Run Docker:

docker run -ti -p 8888:8888 -v ${PWD}:/home suvtools bash

Launch jupyterlab and create python 3 notebook:

jupyter-lab