Development Setup

Make sure you have Poetry and a Celery Broker installed as described in Prerequisites.

Create the Environment

Create the python environment with the required packages. After the --extras flag, provide a quoted, space-separated list with all the package extras you would like to install. An overview of all available extras can be found in the Package Overview. In this example we’re going to install the dependencies for PostgreSQL and LDAP support as well as the Poetry dependency groups containing development tools and tools for the generation of docs.

poetry install --extras "pgsql ldap" --with dev,docs

Then open a shell with this environment loaded by executing

poetry shell

Note

All of the following commands need to be executed inside the Poetry shell.

Now create a .env file by copying the provided sample.

cd heliport_config
cp -i .env.dist .env

Finally, edit the .env file to provide your own settings. Some settings are required, others are commented out and can be left unchanged. The comments will guide you in the process. For a development setup of HELIPORT, DEVELOPMENT should be uncommented and set to True.

Run the Tests

To run the tests, execute pytest in the Poetry shell:

pytest -v

Run the Development Server

To run the server, first do a database migration and then execute the runserver command.

Note

migrate is only required when starting the app for the first time or if the database schema changed since the last start.

heliport-cli migrate
heliport-cli runserver

Start the Celery Worker

Start the Celery worker:

celery -A heliport_config worker

Or run it in the background:

celery -A heliport_config multi start "celery@$HOSTNAME" --logfile=celery.log --pidfile=celery.pid

Build the JavaScript Code Bundles

To build the JavaScript code, the necessary libraries need to be installed. This can be done by running yarnpkg install. Then, running yarnpkg build will create webpacks of the JavaScript and CSS code. To start the webpack development server which keeps the webpacks up to date during development, run yarnpkg dev. If you don’t want to change any Javascript code, running the build command once will suffice.

Note

The yarnpkg command refers to the Yarn package manager. On some systems it might simply be called yarn.

Additional Tips

Admin Interface

If you want an admin for the /admin/ interface, you can create one:

heliport-cli createsuperuser

Contributing

If you want to contribute code, please make sure to format it by running the following formatting commands:

# fix lint violations with Ruff (https://docs.astral.sh/ruff/)
ruff check --fix .
# format Python code
ruff format .
# format Django templates with djlint (https://djlint.com/)
djlint --lint --reformat .
# format css, js, yaml, ... with Prettier (https://prettier.io/)
yarnpkg format

Also, please make sure to add a license header to all new files. reuse can help you with this:

reuse annotate --license GPL-3.0-or-later --copyright "Your institution" path/to/file

You can check if the code is up to the REUSE spec like this:

reuse lint

For automated checks during git commit , the pre-commit hook provided in this repository can be used. You can activate it by copying or linking it into the .git/hooks directory:

ln -rs .gitlab/bin/pre-commit.py .git/hooks/pre-commit

The checks can be skipped using the --no-verify option for git commit.