Installation¶
There are two ways to install expertsystem
. Even though the PyPI installation
is the fastest, we recommend following the Development mode
procedure.
Installation through PyPI¶
The expertsystem
is available as a PyPI package, so installation is super easy:
pip install expertsystem
Et voilà, that’s it! You can try out whether the installation works by running:
import expertsystem
from the Python interpreter. Note that PyPI only allows you to install specific releases, so we recommend using the more dynamic, ‘development mode’ instead.
Development mode¶
The expertsystem
is an academic research project and is bound to continuously
evolve. We therefore highly recommend installing the expertsystem
from the
source code, so that you work with
the latest version.
Moreover, since you read as far as this, you must have an interest in particle physics, and it is researchers like you who can help bring this project further! So please, follow the following sections to set up this ‘interactive installation’.
Step 1: Get the source code¶
The expertsystem
source code is maintained through Git, so you need to install Git first. Once
you’ve done so, navigate to a suitable folder and run:
git clone https://github.com/ComPWA/expertsystem.git
cd expertsystem
After that, there should be a folder called expertsystem
into which we
navigated just now. We’ll call this folder the local repository.
When new commits are merged into the master branch of expertsystem, you need to update your local copy of the source code as follows:
git checkout master
git pull
It’s best to have a clean your working tree before you do a git pull.
Step 2: Create a virtual environment¶
It is safest to install the expertsystem
within a virtual environment, so
that all Python dependencies are contained within there. This is helpful in
case something goes wrong with the dependencies: you can just trash the
environment and recreate it. There are two options: Conda or Python’s venv.
Conda environment¶
Conda can be installed without administrator
rights, see instructions on this page. Once installed, navigate to the
local repository and create the Conda environment for
the expertsystem
as follows:
conda env create
This command uses the environment.yml file and
immediately installs the expertsystem
in development mode.
After Conda finishes creating the environment, you can activate it with as follows:
conda activate es
You need to have the environment called es
activated whenever you want
to run the expertsystem
.
Python venv¶
Alternatively, you can use Python’s venv, if you have that available on your system. All you have to do, is navigate into local repository and run:
python3 -m venv ./venv
This creates a folder called venv
where all Python packages will be
contained. You first have to activate the environment, and will have to do so
whenever you want to run the expertsystem
.
source ./venv/bin/activate
Now you can safely install the expertsystem
in development mode:
pip install -e .
That’s it, now you’re all set to install expertsystem!
Step 3: Test the installation¶
First, navigate out of the main directory of the local repository in order to make sure that the expertsystem
we run, is
the system installation and not the expertsystem
folder in the current
working directory. Then, simply launch a Python interpreter and run:
import expertsystem
If you don’t get any error messages, all worked out nicely!
For more thorough testing, navigate back to the you can run the unit tests:
pip install -e .[test] # install dependencies for testing
pytest -m "not slow"
After that, it’s worth having a look at the contribute page!