Ensure you have the following available on your machine:
- Python
- Docker
To work on this library locally, install the library in edit mode along with the dev dependencies:
# Use .[dev,test] to also install pytest and related libraries
pip install -e '.[dev]'
To spawn the Keycloak Test Server, use the docker-compose.yml (done automatically when running tests, see blow):
docker compose up --wait
The server is configured using the resources in tests/realms
and is available at
http://localhost:9090
. If you need to change anything to the realms, ensure you persist your
changes using make export-realms
.
A Makefile is available for all the usual development tasks. Use help
to list the available
commands:
make help
Build
build Build the wheels and sdist.
Documentation
docs Generate the HTML documentation.
docs-clean Remove docs build artifacts.
docs-open Open the documentation locally (requires make docs to have ran).
Development
lint Run ruff to format and lint (inside docker).
test Run tests with tox (inside docker).
mypy Run mypy locally to check types.
export-realms Export test realms after changes in Keycloak Test Server.
Note that make test
automatically starts a Keycloak container if it isn't already running. You may
have to stop it manually. The test server is configured using the resources in tests/realms
and is
available at http://localhost:9090
. To start the Keycloak server yourself:
docker compose up --wait
You can run the tests directly using pytest
for faster development, just ensure you installed the
test dependencies (pip install -e '.[dev,test]'
) and Keycloak is running.
This repository adheres to the Conventional Commits specification and requires signed commits.
- Fork this repository, develop and test your changes
- Make sure that your changes do not decrease the test coverage
- Create signed commits that follow the conventional commits specification
- If necessary, update the docs
- Submit a pull request