-
Notifications
You must be signed in to change notification settings - Fork 295
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (56 loc) · 1.76 KB
/
Copy pathMakefile
File metadata and controls
76 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Capture extra CLI arguments as ARGS
ARGS ?= $(filter-out $@,$(MAKECMDGOALS))
# Prevent make from treating extra args as targets
%:
@:
PY_ARGS := $(filter %.py,$(ARGS))
actions = \
setup \
test \
cov \
lint-check \
lint-format \
docs-build \
docs-serve \
build \
publish
# ARGS used for `test`. `PY_ARGS` used for `lint` and `format`
PY_ARGS := $(or $(filter %.py,$(ARGS)),sqladmin tests)
# Locale code for `i18n-init` (e.g. `make i18n-init LOCALE=fr`)
LOCALE ?=
setup:
uv sync --all-groups
test:
uv run coverage run -a --concurrency=thread,greenlet -m pytest $(ARGS)
cov:
uv run coverage report
uv run coverage xml
lint:
uv run ruff check $(PY_ARGS)
uv run ruff format --check $(PY_ARGS)
uv run mypy $(PY_ARGS)
format:
uv run ruff format $(PY_ARGS)
uv run ruff check --fix $(PY_ARGS)
secure:
uv run bandit -r sqladmin --config pyproject.toml
# Extract translatable strings into the .pot template and sync every catalog.
i18n-extract:
uv run python -c "import os; os.makedirs('sqladmin/translations', exist_ok=True)"
uv run pybabel extract -F pyproject.toml -o sqladmin/translations/admin.pot .
uv run pybabel update -i sqladmin/translations/admin.pot -d sqladmin/translations -D admin
# Create a catalog for a new locale, e.g. `make i18n-init LOCALE=fr`.
i18n-init:
uv run pybabel init -i sqladmin/translations/admin.pot -d sqladmin/translations -D admin -l $(LOCALE)
# Compile .po catalogs into the binary .mo files loaded at runtime.
i18n-compile:
uv run pybabel compile -d sqladmin/translations -D admin
docs-build:
uv run zensical build
docs-serve:
uv run zensical serve --dev-addr localhost:8080
build:
uv build
publish:
uv publish
.PHONY: setup test cov lint-check lint-format i18n-extract i18n-init i18n-compile docs-build docs-serve build publish