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 requires Python 3.8 or later.
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
bash
python3 -m venv upp
source upp/bin/activate
If you don't want to use conda environments on lxplus, you can setup python via
bash
setupATLAS
lsetup "python 3.9.18-x86_64-el9"
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):
bash
python -m pip install umami-preprocessing
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.
bash
git clone https://github.com/umami-hep/umami-preprocessing.git
Install package from code#
Navigate to the newly downloaded repository and install the package in editable mode:
bash
cd umami-preprocessing
python -m pip install -e .[dev]
If you don't plan on editing the code you can do a regular install instead
bash
python -m pip install .
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
export PATH=$PATH:/afs/cern.ch/user/X/Y/.local/bin
Alternatively, you can just run the scripts by pointing to the main.py
bash
python3 upp/main.py
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
bash
pytest tests
If you want to measure test coverage you can use the commands:
bash
coverage run --source upp -m pytest tests --show-capture=stdout
coverage report
Created: September 5, 2023