Compare commits

...

2 Commits

Author SHA1 Message Date
Teffen Ellis
e75992dbae docs: document local.env.yml prerequisite for Python tooling
mypy and other Python CI targets require a local.env.yml with a
secret_key before they can run. This was only set up automatically in
CI (via .github/actions/setup) but was not mentioned in the contributor
docs. Add a dedicated section explaining why it is needed and how to
generate it with 'make gen-dev-config'.
2026-04-21 01:52:15 +00:00
agent
882f125006 build: guard ci-lint-mypy against missing local.env.yml
mypy_django_plugin initializes Django at startup, which requires
SECRET_KEY to be set. Without local.env.yml (or AUTHENTIK_SECRET_KEY),
Django raises ImproperlyConfigured, which mypy surfaces as a confusing
INTERNAL ERROR. Add an explicit pre-flight check so the failure is
actionable.
2026-04-21 01:51:41 +00:00
2 changed files with 13 additions and 0 deletions

View File

@@ -320,6 +320,7 @@ ci--meta-debug:
node --version || echo "No node installed"
ci-lint-mypy: ci--meta-debug
@test -f local.env.yml || (echo "ERROR: local.env.yml is missing. Run 'make gen-dev-config' first." && exit 1)
$(UV) run mypy --strict $(PY_SOURCES)
ci-lint-black: ci--meta-debug

View File

@@ -122,6 +122,18 @@ authentik can be run locally, although depending on which part you want to work
This is documented in the [developer docs](./setup/frontend-dev-environment.md).
#### Running Python tooling locally (mypy, tests, linting)
Before running any Python CI targets such as `make lint` or `make ci-lint-mypy`, you must generate a local configuration file:
```shell
make gen-dev-config
```
This creates `local.env.yml` in the repository root with a random `secret_key`. It is required because `mypy_django_plugin` initializes Django at startup to introspect models, and Django requires a non-empty `SECRET_KEY`. Without this file (and without an `AUTHENTIK_SECRET_KEY` environment variable), mypy will fail with a confusing internal error.
You only need to run this once per clone. The file is already listed in `.gitignore`.
### Help with the docs
Contributions to the technical documentation are greatly appreciated. Open a PR if you have improvements to make or new content to add. If you have questions or suggestions about the documentation, open an Issue. No contribution is too small.