GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - empa-scientific-it/python-tutorial: Material for a Jupyter-based Python tutorial, with Introductory, Advanced, Libraries modules

BranchesTags
Open more actions menu

Latest commit

 

History

161 Commits
161 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github
.github
 
 
binder
binder
 
 
data
data
 
 
docker
docker
 
 
extra
extra
 
 
images
images
 
 
slides
slides
 
 
tutorial
tutorial
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
.mypy.ini
.mypy.ini
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.yamlfmt
.yamlfmt
 
 
00_index.ipynb
00_index.ipynb
 
 
00_intro.ipynb
00_intro.ipynb
 
 
00_python_intro.ipynb
00_python_intro.ipynb
 
 
01_basic_datatypes.ipynb
01_basic_datatypes.ipynb
 
 
02_control_flow.ipynb
02_control_flow.ipynb
 
 
03_functions.ipynb
03_functions.ipynb
 
 
04_input_output.ipynb
04_input_output.ipynb
 
 
05_object_oriented_programming.ipynb
05_object_oriented_programming.ipynb
 
 
06_modules_and_packages.ipynb
06_modules_and_packages.ipynb
 
 
10_manage_python_project.ipynb
10_manage_python_project.ipynb
 
 
11_functional_programming.ipynb
11_functional_programming.ipynb
 
 
12_functions_advanced.ipynb
12_functions_advanced.ipynb
 
 
13_object_oriented_programming_advanced.ipynb
13_object_oriented_programming_advanced.ipynb
 
 
14_threads.ipynb
14_threads.ipynb
 
 
20_library_matplotlib.ipynb
20_library_matplotlib.ipynb
 
 
21_library_numpy.ipynb
21_library_numpy.ipynb
 
 
22_library_sklearn.ipynb
22_library_sklearn.ipynb
 
 
23_library_scipy.ipynb
23_library_scipy.ipynb
 
 
24_library_pandas.ipynb
24_library_pandas.ipynb
 
 
30_introduction_data_exploration.ipynb
30_introduction_data_exploration.ipynb
 
 
31_image_classification.ipynb
31_image_classification.ipynb
 
 
32_language_modeling_1.ipynb
32_language_modeling_1.ipynb
 
 
Dockerfile
Dockerfile
 
 
FAQ.md
FAQ.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
magic_example.ipynb
magic_example.ipynb
 
 
openai.env.example
openai.env.example
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

python-tutorial

Renku Binder

Build Docker container

Open in GitHub Codespaces

Run the tutorial on your computer

You have two ways in which you can run the tutorial locally.

1. With a conda environment

0. Prerequisites

To run the tutorial locally, you should first install conda (or mamba).

It is also suggested that you have a recent version of git. Check out how to install git on your operating system.

1. Download the material

Go to the directory on your machine where you want to download the material and clone the repository:

git clone https://github.com/empa-scientific-it/python-tutorial

Alternatively, you can manually download a ZIP archive with the latest version of the material:

Download ZIP archive

Extract the archive in a directory of your choice.

2. Create a dedicated environment

Enter the tutorial folder with

cd /path/to/python-tutorial

If you have installed Anaconda, then you can use Anaconda Prompt to run the following commands.

You should now create a new environment with conda:

conda env create -f binder/environment.yml

Warning

If you are on Windows and using Command Prompt or the PowerShell, please make sure to adjust the paths in the commands above accordingly.

Then activate the environment with

conda activate python-tutorial

You can update the existing environment (that is, downloading the latest version of the packages) with:

conda env update -f binder/environment.yml

3. Launch the tutorial via Jupyter

Finally, launch JupyterLab with

jupyter lab

2. With Docker

Note

The following instructions are for Windows. With minor changes, the steps work on macOS or Linux as well.

  1. Install Docker Desktop: First, you need to install Docker Desktop on your Windows machine. You can download it from the official Docker website: https://www.docker.com/products/docker-desktop.

  2. Create a folder: Open File Explorer and create a new folder where you want to save the tutorial's materials. For example, you could create a folder called "python-tutorial" on your Desktop.

  3. Open PowerShell: Once Docker Desktop is installed, open PowerShell on your Windows machine. You can do this by pressing the "Windows" key and typing "PowerShell" in the search bar.

  4. Pull the Docker image: In PowerShell, run the following command to pull the Docker image:

docker pull ghcr.io/empa-scientific-it/python-tutorial:latest

Note

The latest tag points to the CPU-only variant of the image, which is optimized for size and compatibility. If you have a CUDA-compatible GPU and want to use GPU acceleration for PyTorch operations, you can use the CUDA-enabled variant by replacing latest with cuda:

docker pull ghcr.io/empa-scientific-it/python-tutorial:cuda

Important

Using the CUDA variant requires a NVIDIA GPU with compatible drivers properly installed and configured for Docker. See NVIDIA Container Toolkit for setup instructions.

  1. Run the Docker container: Once the image is downloaded, run the following command to start a Docker container from the image:
docker run -p 8888:8888 --name python_tutorial -v /path/to/python-tutorial:/home/jovyan/python-tutorial ghcr.io/empa-scientific-it/python-tutorial:latest jupyter lab --ip 0.0.0.0 --no-browser

Note

If you pulled the CUDA variant, replace :latest with :cuda in the command above.

Replace /path/to/python-tutorial with the path to the folder you created in step 2, for example C:/Users/yourusername/Desktop/python-tutorial.

Note

The above command will mirror the content of your local folder (e.g., C:/Users/yourusername/Desktop/python-tutorial) to the ~/python-tutorial folder inside the container. In this way, every file or folder you copy or create into ~/python-tutorial will be saved on your machine, and will remain there even if you stop Docker.

  1. Access the Jupyter Notebook: Open a web browser and navigate to http://localhost:8888/lab. You should see the Jupyter Notebook interface. Enter the token provided in the PowerShell console to access the notebook. Alternatively, you can directly click on the link that appears in the PowerShell after the container has started.

You can now use the Jupyter in the Docker container to run the python-tutorial. When you're done, you can stop the container by pressing Ctrl+C in the PowerShell console.

Note

If you want to restart the container, you can simply run the command docker container start python_tutorial.

Setup a local dev environment

If you prefer not to use Conda and/or Docker, you can set up a lightweight development environment using either "uv" (a faster alternative to pip) or traditional "pip". Both methods will install the development dependencies specified in the pyproject.toml file.

Both setups assume that you have already cloned the repository with git clone https://github.com/empa-scientific-it/python-tutorial. The commands below should be run from inside the tutorial directory.

Using uv (Recommended for speed)

uv is a fast, Python package installer and resolver written in Rust.

  1. Install uv via pip or any other method:

    pip install uv
  2. Create a virtual environment and install dev dependencies:

    # Create and activate a virtual environment
    uv venv
    # On Windows
    .venv\Scripts\activate
    # On macOS/Linux
    source .venv/bin/activate
    
    # Install dev dependencies
    uv pip install -e ".[dev]"
  3. Launch JupyterLab:

    jupyter lab

Using pip

  1. Create a virtual environment and install dev dependencies:

    # Create and activate a virtual environment
    python -m venv .venv
    # On Windows
    .venv\Scripts\activate
    # On macOS/Linux
    source .venv/bin/activate
    
    # Install dev dependencies
    pip install -e ".[dev]"
  2. Launch JupyterLab:

    jupyter lab

About

Material for a Jupyter-based Python tutorial, with Introductory, Advanced, Libraries modules

Topics

jupyter-notebooksnumpypythonpython-jupyter-notebookspython-pandaspython-tutorialspython4everybodyscipy

Resources

Readme
MIT license
Activity
Custom properties

Stars

57 stars

Watchers

2 watching

Forks

34 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.