Skip to content

Environment

Configuration

Parameter Description Default
debug Enable the debug logs output false
logging_file Enable saving log records to file. This will create a .logs folder false
host Bind the socket to this host address.
Set 0.0.0.0 to make the application available on your local network
127.0.0.1
port Bind to a socket and run the application with this port 8000
reload Enables automatic reloading of the application when files are modified false

You can configure some parameters for the application in the pyproject.toml file, such as:

pyproject.toml
[application]
debug = false
logging_file = false
host = "127.0.0.1"
port = 8000
reload = false

You can also set environment variables to override the default configuration when running the application locally or in a Docker container.

.env
1
2
3
4
5
6
7
8
9
DEBUG=false

LOGGING_FILE=false

HOST=127.0.0.1

PORT=8000

RELOAD=false

Python Environment

It is necessary to prepare an environment with the correct dependencies to work properly with each area of the application. To do this, you need to install Python3 v3.11 with Venv and Pip.

Info

This project uses Poetry to package and manage Python dependencies.

Tip

You can also use Docker to run the application.

Setup the Virtual Environment

# Setup Venv
make setup

# Activate Venv
source .venv/bin/activate

Dependencies

Complete Environment

Install all dependencies.

(.venv) poetry install
(.venv) pip3 install -r requirements/requirements-all.txt

Application Environment

Install only the application dependencies.

(.venv) make install
(.venv) pip3 install -r requirements/requirements.txt


Run the application

# Run the application Locally
(.venv) make run
# Run the application in Docker Container
make docker

Development Environment

Install only the development dependencies.

(.venv) poetry install --only dev
(.venv) pip3 install -r requirements/requirements-dev.txt


Perform Formatting, Linting, and Vulnerability Auditing.

# run Formatting
(.venv) make format

# run Linting
(.venv) make lint

# run Linting in Tests
(.venv) make lint-tests

# run Audit Vulnerability
(.venv) make audit

Tests Environment

Install only the tests dependencies.

(.venv) poetry install --only test
(.venv) pip3 install -r requirements/requirements-test.txt


Run the tests and check the tests coverage

# Run Pytest in Venv
(.venv) make test

# Run Coverage in Venv
(.venv) make coverage
# Run Pytest in Docker
make test-docker

# Run Coverage in Docker
make coverage-docker

Documentation Environment

Install only the documentation dependencies.

(.venv) poetry install --only docs
(.venv) pip3 install -r requirements/requirements-docs.txt


Run Mkdocs documentation.

Run Locally and access the web page at http://127.0.0.1:8000.

# Serve MkDocs
(.venv) make docs

Requirements Files

You can generate multiple requirements files for different purposes.

# Requirements only for the Application dependencies
(.venv) make req

# Requirements for the Application with Development dependencies
(.venv) make req-dev

# Requirements for the Documentation dependencies
(.venv) make req-docs

# Requirements for the Tests dependencies
(.venv) make req-test

# Requirements for All dependencies
(.venv) make req-all