A starter for a SAE stage implementation.
This repository will help you implementing a SAE pipeline stage by putting all the necessary infrastructure in place.
Create your own repository using this template. It is good practice to prefix the repo name with sae- and use a concise name that describes what the stage does.
Careful: Check the repository owner, it defaults to your main user account.
In order to work with this repository, you need to ensure the following steps:
- Install Poetry
- Install Docker with compose plugin
- Clone main SAE repository (you will most likely need a running SAE to do anything useful): https://github.com/starwit/starwit-awareness-engine
To make this repository entirely belong to your new shiny stage, you have to replace various forms of mystage in a few places.
Run set_name.sh and enter the various forms of your new name when prompted. The script will set everything up for you and then delete itself.
If you made a mistake either reclone the repository or run git reset --hard && git clean -fd
- Run
poetry install, this should install all necessary dependencies - Start docker compose version of the SAE (see here: https://github.com/starwit/starwit-awareness-engine/blob/main/docker-compose/README.md)
- Run
poetry run python main.py. If you see log messages likeReceived SAE message from pipeline, everything works as intended.
This template employs pydantic-settings for configuration handling. On startup, the following happens:
- Load defaults (see
config.py) - Read settings
settings.yamlif it exists - Search through environment variables if any match configuration parameters (converted to upper_snake_case, nested levels delimited by
__), overwriting the corresponding setting - Validate settings hierarchy if all necessary values are filled, otherwise Pydantic will throw a hopefully helpful error
The settings.template.yaml should always reflect a correct and fully fledged settings structure to use as a starting point for users.
The following Github Actions are available:
- PR build: Builds python project for each pull request to main branch.
poetry installandpoetry run pytestare executed, to compile and test python code. - Build and publish latest image: Manually executed action. Same like PR build. Additionally puts latest docker image to internal docker registry.
- Create release: Manually executed action. Creates a github release with tag, docker image in internal docker registry, helm chart in chartmuseum by using and incrementing the version in pyproject.toml. Poetry is updating to next version by using "patch, minor and major" keywords. If you want to change to non-incremental version, set version in directly in pyproject.toml and execute create release afterwards.
With dependabot.yml a scheduled version update via Dependabot is configured. Dependabot creates a pull request if newer versions are available and the compilation is checked via PR build.