Dev environment
Setup
- Install Poetry
- Install an environment with Poetry
poetry install
- This will create a virtual environment in
.venv
and install all dependencies - You can also use
poetry shell
to activate the virtual environment - Install pre-commit hooks
Note: You can also use a custom virtual environment based on your preference.
Git leaks detection
Since the repository currently contains secret information in various encrypted forms there is high chance that developer may push a commit with
decrypted secrets by mistake. To avoid this problem we recommend
to use Gitleaks
tool that prevent you from commit secret code into git history.
The repository is already pre-configured but each developer has to make final config changes in his/her environment.
Follow the documentation to configure Gitleaks on your computer.
Package management
The project uses Poetry for package management. You can use the following commands to manage packages:
poetry add <package>
: Add a package to the projectpoetry add --group dev <package>
: Add a package to the development grouppoetry remove <package>
: Remove a package from the projectpoetry update
: Update all packages to their latest versionspoetry install
: Install all packages listed in thepyproject.toml
filepoetry lock
: Lock the dependencies to their current versions
The Petry project uses poetry.lock
file to lock the dependencies to their current versions. This file is automatically generated by Poetry when you run poetry install
or poetry update
. You should not edit this file manually.
Tox
The project uses Tox for testing and linting. You can use the following commands to run Tox:
tox
: Run all tests and linterstox -e <env>
: Run a specific environment (e.g.tox -e test
to run tests )tox -e <env> -- <args>
: Run a specific environment with additional arguments (e.g.tox -e test -- -v
to run tests for with verbose output)
Code formatting
The project uses Ruff for code checking and formatting. You can use the following commands to check and format the code:
tox -e ruff
: Run Ruff to check the code
We highly recommend to configure your IDE to run Ruff on save. This will help you to keep the code clean and consistent.
Testing
The project uses Pytest for testing. You can use the following commands to run tests:
tox -e test
: Run all teststox -e test -- -v
: Run all tests with verbose outputtox -e test -- -k <test_name>
: Run a specific test (e.g.tox -e test -- -k test_example
to run the test namedtest_example
)
Integration Tests
The integration tests require external services to be running. These services are provided locally via Docker Compose.
-
Start the test services:
bash docker compose up -d
-
Run the integration tests:
bash tox -e test-integration
Building the container image
The project contains a Containerfile that can be used to build a container image. You can use the following command to build the image:
podman build -t <image_name> .
Replace <image_name>
with the name you want to give to the image.
Then you can run the image using the following command:
podman run -it <image_name>
Replace <image_name>
with the name of the image you built.