Branch | Status |
---|---|
develop | |
master |
service-control
provides and manages the verified permissions. TBC
Prerequisites on host for development and build:
- python version 3.12
- pipenv
docker
anddocker compose
To create and activate a virtual Python environment with all dependencies installed:
make setup
To start the local postgres container, run this:
make start-local-db
You may want to do an initial sync of your database by applying the most recent Django migrations with
app/manage.py migrate
There are some possibilities to debug this codebase from within visual studio code.
In order to debug the service from within vs code, you need to create a launch-configuration. Create
a folder .vscode
in the root folder if it doesn't exist and put a file launch.json
with this content
in it:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Attach",
"type": "debugpy",
"request": "attach",
"justMyCode": false,
"connect": {
"host": "localhost",
"port": 5678
}
}
]
}
Alternatively, create the file via menu "Run" > "Add Configuration" by choosing
- Debugger: Python Debugger
- Debug Configration: Remote Attach
- Hostname:
localhost
- Port number:
5678
Now you can start the server with make serve-debug
.
The bootup will wait with the execution until the debugger is attached, which can most easily done by hitting F5.
The unit tests can also be invoked inside vs code directly (beaker icon).
To do this you need to have the following settings either in
.vscode/settings.json
or in your workspace settings:
"python.testing.pytestArgs": [
"app"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
You can also create this file interactively via menu "Python: Configure Tests" in the Command Palette (Ctrl+Shift+P).
For the automatic test discovery to work, make sure that vs code has the Python
interpreter of your venv selected (.venv/bin/python
).
You can change the Python interpreter via menu "Python: Select Interpreter"
in the Command Palette.
Type checking can be done by either calling mypy
or the make target:
make type-check
This will check all files in the repository.
For type-checking, the external library mypy is being used. See the type hints cheat sheet for help on getting the types right.
Some 3rd party libraries need to have explicit type stubs installed for the type checker to work. Some of them can be found in typeshed. Sometimes dedicated packages exist, as is the case with django-stubs.
If there aren't any type hints available, they can also be auto-generated with stubgen