Trustpoint Development environment setupΒΆ

InstallationΒΆ

Trustpoint uses the Python Django framework.
We are using uv to manage different python versions and dependencies.

Please note that the current version is in development status and still subject to major changes. Our aim is to make an operational version of the software available quickly in order to receive as much feedback as possible from users.

Install uvΒΆ

You should use uv to create a virtual environment and to manage the dependencies (instead of pip directly).
Check out the official documentation for the installer

In simple cases, installing uv is as straightforward as:

pip install uv

Install dependencies with uvΒΆ

If you have an existing virtual environment, e.g. through using python3 -m venv, exit the virtual environment (that is make sure you are not in the environment). You can usually exit it with:

deactivate

Then, remove any virtual environment you may have set up, e.g. .venv/ directory.

Finally, install everything through uv:

cd /path/to/trustpoint/
uv sync

Activating the environmentΒΆ

It is generally not required to manually activate the virtual environment, just start your command with uv run instead of python. However, if you do want to activate the environment manually, you can do so using

source .venv/bin/activate

UsageΒΆ

Setting up the DB and SuperUserΒΆ

The development server supports a PostgreSQL database by default. The connection settings can be configured in the settings.py file. If the configured database is not available, the server will fall back to a built-in SQLite database.

Next, it is required to migrate (creating the required tables) and create a superuser. The superuser credentials admin/testing321 can later be used to access the Trustpoint user interface at localhost:8000.

cd trustpoint
uv run manage.py reset_db

Finally, compile the translation strings for non-English language support:

uv run manage.py compilemsg -l de

Running the development serverΒΆ

uv run manage.py runserver

You can then access the GUI through localhost:8000.

Alternatively, use the following command to run a development HTTPS server (self-signed certificate).

python manage.py runserver_plus 0.0.0.0:443 --cert-file ../tests/data/x509/https_server.crt --key-file ../tests/data/x509/https_server.pem

Use the following command to automatically generate a self-signed TLS server certificate for your current IP addresses:

python manage.py create_tls_certs

Logging inΒΆ

Browsing to any page should redirect you to the login page. The login page can be accessed directly via /users/login/.

Use the username and password which you previously provided through the createsuperuser command.

Management commands for testing and development purposesΒΆ

uv run manage.py reset_db

Clears the database and restores Trustpoint to the initial state.

uv run manage.py add_domains_and_devices

Populates the database with an example CA, domain and device instances.

uv run manage.py makemsg -l de
uv run manage.py makemsg -l de -d djangojs

Makes the translation (.po) files from translatable strings. gettext must be installed on your system.

uv run manage.py compilemsg -l de

Compiles the translation files (.po) to binary (.mo) files actually used by Django.

Building auto documentationΒΆ

cd ../docs
sphinx-apidoc -f -e -o ./source ../trustpoint /*/migrations/*
make html

Adding dependencies to the projectΒΆ

Dependencies generally required for the project can be added using the following:

uv add <name-of-package>

Dependencies that are only required in development, use the following to add in within the dev section:

uv add <name-of-package> --dev

Testing & CIΒΆ

Using the ruff linter and formatterΒΆ

For linting everything in the current directory use:

uv run ruff check . --output-format=concise

For active formatting everything in the current directory use:

uv run ruff format .

For type checking, we use mypy:

uv run mypy .

Running pytest unit testsΒΆ

Trustpoint uses pytest to run self-contained tests, either unit tests or integration tests that do not involve a request-response cycle:

uv run pytest

Running BDD tests with behaveΒΆ

Trustpoint uses behave to run BDD tests. The tests are located in the features/ directory:

uv run behave