Build and install

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

When you install expertsystem, 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

The build output is written to a folder build 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 .

That’s all! The virtual environment while now use the expertsystem folder in your local repository when you import expertsystem.

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 launch a Python interpreter and run:

import expertsystem

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"