Test API
- Install python >=3.10
Install the latest version of python >=3.10 available.
You can find all Python releases on https://www.python.org/downloads/release
- Setup a new virtual environment
Run command:
{PATH TO PYTHON 3.10} -m venv {PATH TO VIRTUAL ENVIRONMENT}
// Example in project folder
python3 -m venv venv
- Active virtual environment
Run command:
// Windows - CMD
{PATH TO VIRTUAL ENVIRONMENT}\Scripts\Activate.bat
// Windows - PowerShell
{PATH TO VIRTUAL ENVIRONMENT}\Scripts\Activate.ps1
- Update Pip Run command:
python -m pip install --upgrade pip
- Install the project requirements Run command:
pip install -r requirements.txt
- Install project in editable mode Run command:
pip install -e .
Running the project starts a REST service that runs until stopped.
By default, the project runs in development mode, meaning that debug messages will be displayed. For development, we can start it using the Flask CLI directly.
.env.bat
flask run -p 5000
The documentation of the project is located in the docs
folder. It is automatically generated using Sphinx.
To build the documentation, run:
sphinx-apidoc -f -o .\docs\source\ testapi
sphinx-build -b html .docs\\source\ .\docs\build\
Then, open the index.html file in the build
directory and browse the documentation to your liking.
Run command:
pip install -r requirements_dev.txt
To run the test suite, run tox
. tox
will also automatically format your code and sort all your imports.
You can also run the tests using pytest
directly.