-
-
Notifications
You must be signed in to change notification settings - Fork 989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Tidy contributor onboarding, fix typos. #12700
base: main
Are you sure you want to change the base?
Changes from all commits
2312760
6cad993
7c2395f
3260d50
2f2a732
7ed8386
10893ee
b15cc94
f69153f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
akadmin | ||
asgi | ||
assertIn | ||
authentik | ||
authn | ||
crate | ||
docstrings | ||
entra | ||
goauthentik | ||
gunicorn | ||
hass | ||
jwe | ||
jwks | ||
keypair | ||
keypairs | ||
hass | ||
warmup | ||
kubernetes | ||
oidc | ||
ontext | ||
openid | ||
passwordless | ||
plex | ||
saml | ||
scim | ||
singed | ||
assertIn | ||
slo | ||
sso | ||
totp | ||
traefik | ||
# https://github.com/codespell-project/codespell/issues/1224 | ||
upToDate | ||
warmup | ||
webauthn |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||||
PWD = $(shell pwd) | ||||||||
UID = $(shell id -u) | ||||||||
GID = $(shell id -g) | ||||||||
NPM_VERSION = $(shell python -m scripts.npm_version) | ||||||||
NPM_VERSION = $(shell python -m scripts.generate_semver) | ||||||||
PY_SOURCES = authentik tests scripts lifecycle .github website/docs/install-config/install/aws | ||||||||
DOCKER_IMAGE ?= "authentik:test" | ||||||||
|
||||||||
|
@@ -16,20 +16,6 @@ pg_user := $(shell python -m authentik.lib.config postgresql.user 2>/dev/null) | |||||||
pg_host := $(shell python -m authentik.lib.config postgresql.host 2>/dev/null) | ||||||||
pg_name := $(shell python -m authentik.lib.config postgresql.name 2>/dev/null) | ||||||||
|
||||||||
CODESPELL_ARGS = -D - -D .github/codespell-dictionary.txt \ | ||||||||
-I .github/codespell-words.txt \ | ||||||||
-S 'web/src/locales/**' \ | ||||||||
-S 'website/docs/developer-docs/api/reference/**' \ | ||||||||
authentik \ | ||||||||
internal \ | ||||||||
cmd \ | ||||||||
web/src \ | ||||||||
website/src \ | ||||||||
website/blog \ | ||||||||
website/docs \ | ||||||||
website/integrations \ | ||||||||
website/src | ||||||||
|
||||||||
all: lint-fix lint test gen web ## Lint, build, and test everything | ||||||||
|
||||||||
HELP_WIDTH := $(shell grep -h '^[a-z][^ ]*:.*\#\#' $(MAKEFILE_LIST) 2>/dev/null | \ | ||||||||
|
@@ -55,23 +41,21 @@ test-docker: ## Run all tests in a docker-compose | |||||||
rm -f .env | ||||||||
|
||||||||
test: ## Run the server tests and produce a coverage report (locally) | ||||||||
coverage run manage.py test --keepdb authentik | ||||||||
coverage html | ||||||||
coverage report | ||||||||
poetry run coverage run manage.py test --keepdb authentik | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We usually assume devs will already be in a However, in CI ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @rissson! Thanks for reviewing my PR. I'm open to either approach, but it may help to keep the prefix. When running ❯ make test
coverage run manage.py test --keepdb authentik
make: coverage: No such file or directory
make: *** [test] Error 1 The virtual environment instructions appear in the full-stack setup docs, but my concern is that contributors who start with the front-end or docs environments might miss the Python requirements when switching contexts. Since ci-main.yml uses the poetry prefix consistently, would it make sense to keep it for now? We could look at removing it from both places as a separate task if you think that would be valuable. Thanks for your feedback! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if you add Both approaches (having it in CI or having it in the Makefile) are valid, but I think we should only do one of them. I agree that having it in the Makefile is easier for new contributors |
||||||||
poetry run coverage html | ||||||||
poetry run coverage report | ||||||||
|
||||||||
lint-fix: lint-codespell ## Lint and automatically fix errors in the python source code. Reports spelling errors. | ||||||||
black $(PY_SOURCES) | ||||||||
ruff check --fix $(PY_SOURCES) | ||||||||
poetry run black $(PY_SOURCES) | ||||||||
poetry run ruff check --fix $(PY_SOURCES) | ||||||||
|
||||||||
lint-codespell: ## Reports spelling errors. | ||||||||
codespell -w $(CODESPELL_ARGS) | ||||||||
poetry run codespell -w | ||||||||
|
||||||||
lint: ## Lint the python and golang sources | ||||||||
bandit -r $(PY_SOURCES) -x web/node_modules -x tests/wdio/node_modules -x website/node_modules | ||||||||
golangci-lint run -v | ||||||||
Comment on lines
-70
to
-71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why those got removed |
||||||||
|
||||||||
core-install: | ||||||||
poetry install | ||||||||
poetry run bandit -c pyproject.toml -r $(PY_SOURCES) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
migrate: ## Run the Authentik Django server's migrations | ||||||||
python -m lifecycle.migrate | ||||||||
|
@@ -193,7 +177,7 @@ gen-client-go: gen-clean-go ## Build and install the authentik API for Golang | |||||||
rm -rf ./${GEN_API_GO}/config.yaml ./${GEN_API_GO}/templates/ | ||||||||
|
||||||||
gen-dev-config: ## Generate a local development config file | ||||||||
python -m scripts.generate_config | ||||||||
poetry run scripts/generate_config.py | ||||||||
|
||||||||
gen: gen-build gen-client-ts | ||||||||
|
||||||||
|
@@ -274,16 +258,17 @@ ci--meta-debug: | |||||||
node --version | ||||||||
|
||||||||
ci-black: ci--meta-debug | ||||||||
black --check $(PY_SOURCES) | ||||||||
poetry run black --check $(PY_SOURCES) | ||||||||
|
||||||||
ci-ruff: ci--meta-debug | ||||||||
ruff check $(PY_SOURCES) | ||||||||
poetry run ruff check $(PY_SOURCES) | ||||||||
|
||||||||
ci-codespell: ci--meta-debug | ||||||||
codespell $(CODESPELL_ARGS) -s | ||||||||
poetry run codespell -s | ||||||||
|
||||||||
ci-bandit: ci--meta-debug | ||||||||
bandit -r $(PY_SOURCES) | ||||||||
poetry run bandit -r $(PY_SOURCES) | ||||||||
golangci-lint run -v internal/... | ||||||||
Comment on lines
+270
to
+271
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
ci-pending-migrations: ci--meta-debug | ||||||||
ak makemigrations --check |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,11 +4,11 @@ | |||
import sys | ||||
import warnings | ||||
|
||||
from authentik.lib.config import CONFIG | ||||
from cryptography.hazmat.backends.openssl.backend import backend | ||||
from defusedxml import defuse_stdlib | ||||
from django.utils.autoreload import DJANGO_AUTORELOAD_ENV | ||||
|
||||
from authentik.lib.config import CONFIG | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
from lifecycle.migrate import run_migrations | ||||
from lifecycle.wait_for_db import wait_for_db | ||||
|
||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -4,6 +4,26 @@ version = "2024.12.2" | |||||||
description = "" | ||||||||
authors = ["authentik Team <[email protected]>"] | ||||||||
|
||||||||
[tool.bandit] | ||||||||
exclude_dirs = ["**/node_modules/**"] | ||||||||
|
||||||||
[tool.codespell] | ||||||||
skip = [ | ||||||||
"**/node_modules", | ||||||||
"**/package-lock.json", | ||||||||
"schema.yml", | ||||||||
"./blueprints/schema.json", | ||||||||
"go.sum", | ||||||||
"cmd", | ||||||||
"internal", | ||||||||
"web/src", | ||||||||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
These are source code directories that we don't want to ignore |
||||||||
"locale", | ||||||||
"**/web/xliff/**", | ||||||||
"./website/build/**", | ||||||||
"*.api.mdx", | ||||||||
] | ||||||||
dictionary = ".github/codespell-dictionary.txt,-" | ||||||||
ignore-words = ".github/codespell-words.txt" | ||||||||
[tool.black] | ||||||||
line-length = 100 | ||||||||
target-version = ['py312'] | ||||||||
|
@@ -12,7 +32,7 @@ exclude = 'node_modules' | |||||||
[tool.ruff] | ||||||||
line-length = 100 | ||||||||
target-version = "py312" | ||||||||
exclude = ["**/migrations/**", "**/node_modules/**"] | ||||||||
exclude = ["web/tools/**", "**/migrations/**", "**/node_modules/**"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we excluding those scripts from being linted and formatted? |
||||||||
|
||||||||
[tool.ruff.lint] | ||||||||
select = [ | ||||||||
|
@@ -122,7 +142,9 @@ kubernetes = "*" | |||||||
ldap3 = "*" | ||||||||
lxml = "*" | ||||||||
msgraph-sdk = "*" | ||||||||
opencontainers = { git = "https://github.com/vsoch/oci-python", rev = "20d69d9cc50a0fef31605b46f06da0c94f1ec3cf", extras = ["reggie"] } | ||||||||
opencontainers = { git = "https://github.com/vsoch/oci-python", rev = "20d69d9cc50a0fef31605b46f06da0c94f1ec3cf", extras = [ | ||||||||
"reggie", | ||||||||
] } | ||||||||
packaging = "*" | ||||||||
paramiko = "*" | ||||||||
psycopg = { extras = ["c"], version = "*" } | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Generate config for development""" | ||
|
||
from yaml import safe_dump | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Generates a Semantic Versioning identifier, suffixed with a timestamp. | ||
""" | ||
|
||
from time import time | ||
|
||
from authentik import __version__ as package_version | ||
|
||
""" | ||
See: https://semver.org/#spec-item-9 (Pre-release spec) | ||
""" | ||
pre_release_timestamp = int(time()) | ||
|
||
print(f"{package_version}-{pre_release_timestamp}") |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also do this