-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
122 lines (93 loc) · 3.23 KB
/
Justfile
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
set dotenv-load := true
@_default:
just --list
# ----------------------------------------------------------------------
# DEPENDENCIES
# ----------------------------------------------------------------------
bootstrap:
@just pup
@just install
install:
python -m uv pip install --editable '.[dev]'
pup:
python -m pip install --upgrade pip uv
# ----------------------------------------------------------------------
# TESTING/TYPES
# ----------------------------------------------------------------------
test *ARGS:
python -m nox --session "test" -- "{{ ARGS }}"
testall *ARGS:
python -m nox --session "tests" -- "{{ ARGS }}"
coverage:
python -m nox --session "coverage"
types:
python -m nox --session "mypy"
# ----------------------------------------------------------------------
# DJANGO
# ----------------------------------------------------------------------
manage *COMMAND:
#!/usr/bin/env python
import sys
try:
from django.conf import settings
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
settings.configure(
INSTALLED_APPS=[
"django.contrib.contenttypes",
"django_q",
"django_q_registry"
],
SECRET_KEY="not needed",
)
execute_from_command_line(sys.argv + "{{ COMMAND }}".split(" "))
alias mm := makemigrations
makemigrations *APPS:
@just manage makemigrations {{ APPS }}
migrate *ARGS:
@just manage migrate {{ ARGS }}
# ----------------------------------------------------------------------
# DOCS
# ----------------------------------------------------------------------
@docs-install:
@just pup
python -m uv pip install 'django-q-registry[docs] @ .'
@docs-serve:
#!/usr/bin/env sh
just _cog
if [ -f "/.dockerenv" ]; then
sphinx-autobuild docs docs/_build/html --host "0.0.0.0"
else
sphinx-autobuild docs docs/_build/html --host "localhost"
fi
@docs-build LOCATION="docs/_build/html":
just _cog
sphinx-build docs {{ LOCATION }}
_cog:
cog -r docs/development/just.md
# ----------------------------------------------------------------------
# UTILS
# ----------------------------------------------------------------------
# format justfile
fmt:
just --fmt --unstable
# run pre-commit on all files
lint:
python -m nox --session "lint"
# ----------------------------------------------------------------------
# COPIER
# ----------------------------------------------------------------------
# apply a copier template to project
copier-copy TEMPLATE_PATH DESTINATION_PATH=".":
copier copy {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }}
# update the project using a copier answers file
copier-update ANSWERS_FILE *ARGS:
copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }}
# loop through all answers files and update the project using copier
@copier-update-all *ARGS:
for file in `ls .copier/`; do just copier-update .copier/$file "{{ ARGS }}"; done