|
1 | 1 | set dotenv-load := true |
| 2 | +set unstable := true |
2 | 3 |
|
3 | | -@_default: |
4 | | - just --list |
| 4 | +mod copier ".just/copier.just" |
| 5 | +mod docs ".just/documentation.just" |
5 | 6 |
|
6 | | -demo: |
7 | | - python -m nox -session "demo" |
8 | | - |
9 | | -# ---------------------------------------------------------------------- |
10 | | -# DEPENDENCIES |
11 | | -# ---------------------------------------------------------------------- |
12 | | - |
13 | | -bootstrap: |
14 | | - @just pup |
15 | | - @just install |
| 7 | +[private] |
| 8 | +default: |
| 9 | + @just --list |
16 | 10 |
|
17 | | -install: |
18 | | - python -m uv pip install --editable '.[dev]' |
19 | | - |
20 | | -pup: |
21 | | - python -m pip install --upgrade pip uv |
22 | | - |
23 | | -# ---------------------------------------------------------------------- |
24 | | -# TESTING/TYPES |
25 | | -# ---------------------------------------------------------------------- |
| 11 | +[private] |
| 12 | +fmt: |
| 13 | + @just --fmt |
| 14 | + @just copier fmt |
| 15 | + @just docs fmt |
26 | 16 |
|
27 | | -test *ARGS: |
28 | | - python -m nox --session "test" -- "{{ ARGS }}" |
| 17 | +[private] |
| 18 | +nox SESSION *ARGS: |
| 19 | + uv run nox --session "{{ SESSION }}" -- "{{ ARGS }}" |
29 | 20 |
|
30 | | -testall *ARGS: |
31 | | - python -m nox --session "tests" -- "{{ ARGS }}" |
| 21 | +bootstrap: |
| 22 | + uv python install |
| 23 | + uv sync --frozen |
32 | 24 |
|
33 | 25 | coverage: |
34 | | - python -m nox --session "coverage" |
35 | | - |
36 | | -types: |
37 | | - python -m nox --session "mypy" |
38 | | - |
39 | | -# ---------------------------------------------------------------------- |
40 | | -# DJANGO |
41 | | -# ---------------------------------------------------------------------- |
42 | | - |
43 | | -manage *COMMAND: |
44 | | - #!/usr/bin/env python |
45 | | - import sys |
46 | | - |
47 | | - try: |
48 | | - from django.conf import settings |
49 | | - from django.core.management import execute_from_command_line |
50 | | - except ImportError as exc: |
51 | | - raise ImportError( |
52 | | - "Couldn't import Django. Are you sure it's installed and " |
53 | | - "available on your PYTHONPATH environment variable? Did you " |
54 | | - "forget to activate a virtual environment?" |
55 | | - ) from exc |
| 26 | + @just nox coverage |
56 | 27 |
|
57 | | - settings.configure(INSTALLED_APPS=["django_simple_nav"]) |
58 | | - execute_from_command_line(sys.argv + "{{ COMMAND }}".split(" ")) |
59 | | - |
60 | | -alias mm := makemigrations |
61 | | - |
62 | | -makemigrations *APPS: |
63 | | - @just manage makemigrations {{ APPS }} |
64 | | - |
65 | | -migrate *ARGS: |
66 | | - @just manage migrate {{ ARGS }} |
67 | | - |
68 | | -# ---------------------------------------------------------------------- |
69 | | -# DOCS |
70 | | -# ---------------------------------------------------------------------- |
71 | | - |
72 | | -@docs-install: |
73 | | - @just pup |
74 | | - python -m uv pip install 'django-simple-nav[docs] @ .' |
75 | | - |
76 | | -@docs-serve: |
77 | | - #!/usr/bin/env sh |
78 | | - just _cog |
79 | | - if [ -f "/.dockerenv" ]; then |
80 | | - sphinx-autobuild docs docs/_build/html --host "0.0.0.0" |
81 | | - else |
82 | | - sphinx-autobuild docs docs/_build/html --host "localhost" |
83 | | - fi |
84 | | - |
85 | | -@docs-build LOCATION="docs/_build/html": |
86 | | - just _cog |
87 | | - sphinx-build docs {{ LOCATION }} |
88 | | - |
89 | | -_cog: |
90 | | - cog -r docs/development/just.md |
91 | | - |
92 | | -# ---------------------------------------------------------------------- |
93 | | -# UTILS |
94 | | -# ---------------------------------------------------------------------- |
95 | | - |
96 | | -# format justfile |
97 | | -fmt: |
98 | | - just --fmt --unstable |
| 28 | +demo: |
| 29 | + @just nox demo |
99 | 30 |
|
100 | | -# run pre-commit on all files |
101 | 31 | lint: |
102 | | - python -m nox --session "lint" |
| 32 | + uv run --with pre-commit-uv pre-commit run --all-files |
| 33 | + just fmt |
103 | 34 |
|
104 | | -# ---------------------------------------------------------------------- |
105 | | -# COPIER |
106 | | -# ---------------------------------------------------------------------- |
| 35 | +lock *ARGS: |
| 36 | + uv lock {{ ARGS }} |
107 | 37 |
|
108 | | -# apply a copier template to project |
109 | | -copier-copy TEMPLATE_PATH DESTINATION_PATH=".": |
110 | | - copier copy {{ TEMPLATE_PATH }} {{ DESTINATION_PATH }} |
| 38 | +test *ARGS: |
| 39 | + @just nox test {{ ARGS }} |
111 | 40 |
|
112 | | -# update the project using a copier answers file |
113 | | -copier-update ANSWERS_FILE *ARGS: |
114 | | - copier update --trust --answers-file {{ ANSWERS_FILE }} {{ ARGS }} |
| 41 | +testall *ARGS: |
| 42 | + @just nox tests {{ ARGS }} |
115 | 43 |
|
116 | | -# loop through all answers files and update the project using copier |
117 | | -@copier-update-all *ARGS: |
118 | | - for file in `ls .copier/`; do just copier-update .copier/$file "{{ ARGS }}"; done |
| 44 | +types *ARGS: |
| 45 | + @just nox types {{ ARGS }} |
0 commit comments