Build and install

Warning

pycompwa is no longer maintained. Use the ComPWA packages QRules, AmpForm, and TensorWaves instead!

Once you have the source code and have activated the virtual environment, you’re ready to build and install pycompwa.

When you install pycompwa, you are telling the system where to find it. There are two ways of doing this:

  1. by copying the source code and binaries to a folder known to the system (you do this with setuptools)

  2. by telling the system to directly monitor the local repository as the installation path (we call this ‘developer mode’).

The second option is more dynamic, because any changes to the source code are immediately available at runtime, which allows you to tweak the code and try things out. When using the first option, you would have to run setuptools again to make the changes known to the system.

Using setuptools

This is easy-peasy! Just navigate to the local repository and run:

python setup.py install -- -- -j2

where you may change 2 to to the number of cores on your system. The build output is written to a folder _skbuild and copied to the virtual environment directory.

Developer Mode

In this set-up, we first tell the virtual environment to monitor the source code directory as an install directory. So, navigate to the base folder of the local repository then, depending on which virtual environment you chose, do the following:

conda develop .
pip install virtualenvwrapper
source venv/bin/virtualenvwrapper.sh
add2virtualenv .

We now call cmake directly to build the ComPWA backend:

mkdir -p build
cd build
cmake ..
cmake --build . -- -j2

The most important binary build file is the shared library for the pycompwa.ui package. You need to set a symbolic link to this file from the pycompwa source code folder:

cd ../src/pycompwa
rm -f ui.*.so  # in case you already created a symlink
ln -s ../../build/ui.*.so

Test the installation

First, navigate out of the main directory of the local repository in order to make sure that the pycompwa we run is the system installation and not the pycompwa folder in the current working directory. Then, simply launch launch a Python interpreter and run:

import pycompwa

If you don’t get any error messages, all worked out nicely!

For more thorough testing you can run the unit tests:

cd tests
pip install -r requirements.txt
pytest -m "not slow"

You can now go through the ComPWA Workflow to learn how to use pycompwa.