4. Set up your project locally
In this section, we will set up the project development environment on your own computer. This part of the tutorial has the greatest potential for stumbling-blocks, because it involves the installation of software.
If you do run into any difficulties, don’t hesitate to contact support, who will be glad to help you out.
After everything has been set up, you will be able to run the unit tests that are included locally.
4.1. Install pyenv
If you are using Windows, we assume you are using WSL 2.
Pyenv is a tool that allows us to manage and install different Python installations.
On Windows install the Linux version of pyenv in your WSL 2 terminal to get everything working.
Follow these instructions to install pyenv on Linux, Mac or WSL 2 on Windows. You can check if the installation was successful by running the following command.
pyenv version
4.2. Create Python virtual environment
4.2.1. Set the local Python version
In the project folder, set the local Python version using pyenv.
pyenv install
pyenv local
4.2.2. Set up the virtual environment
Create the virtual environment:
python -m venv venv
source ./venv/bin/activate
Install the project dependencies in the virtual environment (this might take a while):
pip install -r requirements.txt
pip install -r dev-requirements.txt
Install the project itself in the virtual environment:
pip install -e .
4.3. Run the tests
python -m pytest --cov=src tests
🎉 Your project development environment is now setup and ready to roll.