Setup
This guide will walk you through the process of setting up the Umami-Preprocessing Python package on your system.
Environment Setup#
Install UPP in a virtual environment to avoid conflicts with other software libraries. UPP currently supports Python 3.11, 3.12, 3.13 and 3.14.
uv is a fast Python package and project manager and is
the recommended way to develop UPP. Install it following the
official instructions, then
let uv create and manage the environment for you:
When working from a clone of the repository you can skip the manual environment setup
entirely and use uv sync (see below).
venv is a lightweight solution for creating virtual python environments, however it is not as fully featured as a fully fledged package manager such as conda. Create a fresh virtual environment and activate it using
If you don't want to use conda environments on lxplus, you can setup python via
You can also set up conda on lxplus
PyPi installation#
If you don't plan on editing the source code, the simplest way to install UPP directly from the Python Package Index (PyPI):
On lxplus you may have to use python3 instead of just python
Download source code#
The following instructions are only relevant for those that wish to modify UPP source code. Start by cloning the Umami-Preprocessing repository. If you want to contribute to the development of UPP, you should fork the repository and make sure you do all your edits in a development branch.
Install package from code#
Navigate to the newly downloaded repository and install the package in editable mode.
uv sync creates a virtual environment in .venv and installs UPP together with the
development dependency group in editable mode:
Prefix subsequent commands with uv run (e.g. uv run preprocess ...) or activate the
environment with source .venv/bin/activate.
If you don't plan on editing the code you can do a regular install instead
Note for running on lxplus
Again, you may have to use python3 here.
You may also see a warning like this:
WARNING: The script preprocess is installed in '/afs/cern.ch/user/X/Y/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
if you do, you can add the directory to your path using
Alternatively, you can just run the scripts by pointing to the main.py
Container image#
If you don't want to set up a Python environment at all, you can use the UPP container image.
The CI builds gitlab-registry.cern.ch/aft/training-images/upp-images/upp:latest on every merge to
main and a tagged image upp:<tag> (e.g. upp:v0.3.1) for every release. The image comes with UPP
and its command line scripts (preprocess, check_input_samples, list_components) pre-installed.
On clusters (lxplus, HPC sites), apptainer can run the image directly from the registry:
apptainer exec docker://gitlab-registry.cern.ch/aft/training-images/upp-images/upp:latest \
preprocess --config <path/to/config.yaml>
The first docker:// invocation converts the image to apptainer's SIF format, which takes a
while. If you run UPP repeatedly, pull the image once and use the local file instead:
apptainer pull upp_latest.sif docker://gitlab-registry.cern.ch/aft/training-images/upp-images/upp:latest
apptainer exec upp_latest.sif preprocess --config <path/to/config.yaml>
By default apptainer shares your home directory and working directory with the container. For a
cleaner environment use --contain and bind only the paths you need (your input ntuples and
output directory) with -B, keeping the working directory with --pwd:
Pin a release tag for production
upp:latest follows the main branch and changes over time. For reproducible production
preprocessing, use a tagged release image like upp:v0.3.1 instead.
For running UPP as batch jobs on Slurm clusters with the container image, see Running on HPC.
Run the tests (Optional)#
To ensure that the package is working correctly, you can run the tests using the pytest framework.
Use pytest to run the tests to make sure the package works
If you want to measure test coverage you can use the commands: