Skip to content

Commit 5af984c

Browse files
committed
build(justfile): Add recipe groups for organized listing
why: Improve discoverability with just 1.45.0 grouped recipes what: - Add [group] attributes to root justfile (test, lint, docs, format, typing, dev) - Add [group] attributes to docs/justfile (build, validate, dev, misc)
1 parent 371c9a1 commit 5af984c

2 files changed

Lines changed: 49 additions & 36 deletions

File tree

docs/justfile

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,143 +20,154 @@ allsphinxopts := "-d " + builddir + "/doctrees " + sphinxopts + " ."
2020
default:
2121
@just --list
2222

23-
# ============================================================================
24-
# Build targets
25-
# ============================================================================
26-
2723
# Build HTML documentation
24+
[group: 'build']
2825
html:
2926
{{ sphinxbuild }} -b html {{ allsphinxopts }} {{ builddir }}/html
3027
@echo ""
3128
@echo "Build finished. The HTML pages are in {{ builddir }}/html."
3229

33-
# Clean build directory
34-
clean:
35-
rm -rf {{ builddir }}/*
36-
3730
# Build directory HTML files
31+
[group: 'build']
3832
dirhtml:
3933
{{ sphinxbuild }} -b dirhtml {{ allsphinxopts }} {{ builddir }}/dirhtml
4034
@echo ""
4135
@echo "Build finished. The HTML pages are in {{ builddir }}/dirhtml."
4236

4337
# Build single HTML file
38+
[group: 'build']
4439
singlehtml:
4540
{{ sphinxbuild }} -b singlehtml {{ allsphinxopts }} {{ builddir }}/singlehtml
4641
@echo ""
4742
@echo "Build finished. The HTML page is in {{ builddir }}/singlehtml."
4843

4944
# Build EPUB
45+
[group: 'build']
5046
epub:
5147
{{ sphinxbuild }} -b epub {{ allsphinxopts }} {{ builddir }}/epub
5248
@echo ""
5349
@echo "Build finished. The epub file is in {{ builddir }}/epub."
5450

5551
# Build LaTeX files
52+
[group: 'build']
5653
latex:
5754
{{ sphinxbuild }} -b latex {{ allsphinxopts }} {{ builddir }}/latex
5855
@echo ""
5956
@echo "Build finished; the LaTeX files are in {{ builddir }}/latex."
6057

6158
# Build PDF via LaTeX
59+
[group: 'build']
6260
latexpdf:
6361
{{ sphinxbuild }} -b latex {{ allsphinxopts }} {{ builddir }}/latex
6462
@echo "Running LaTeX files through pdflatex..."
6563
make -C {{ builddir }}/latex all-pdf
6664
@echo "pdflatex finished; the PDF files are in {{ builddir }}/latex."
6765

6866
# Build plain text files
67+
[group: 'build']
6968
text:
7069
{{ sphinxbuild }} -b text {{ allsphinxopts }} {{ builddir }}/text
7170
@echo ""
7271
@echo "Build finished. The text files are in {{ builddir }}/text."
7372

7473
# Build man pages
74+
[group: 'build']
7575
man:
7676
{{ sphinxbuild }} -b man {{ allsphinxopts }} {{ builddir }}/man
7777
@echo ""
7878
@echo "Build finished. The manual pages are in {{ builddir }}/man."
7979

8080
# Build JSON output
81+
[group: 'build']
8182
json:
8283
{{ sphinxbuild }} -b json {{ allsphinxopts }} {{ builddir }}/json
8384
@echo ""
8485
@echo "Build finished; now you can process the JSON files."
8586

87+
# Clean build directory
88+
[group: 'misc']
89+
[confirm]
90+
clean:
91+
rm -rf {{ builddir }}/*
92+
8693
# Build HTML help files
94+
[group: 'misc']
8795
htmlhelp:
8896
{{ sphinxbuild }} -b htmlhelp {{ allsphinxopts }} {{ builddir }}/htmlhelp
8997
@echo ""
9098
@echo "Build finished; now you can run HTML Help Workshop with the .hhp project file in {{ builddir }}/htmlhelp."
9199

92100
# Build Qt help files
101+
[group: 'misc']
93102
qthelp:
94103
{{ sphinxbuild }} -b qthelp {{ allsphinxopts }} {{ builddir }}/qthelp
95104
@echo ""
96105
@echo "Build finished; now you can run 'qcollectiongenerator' with the .qhcp project file in {{ builddir }}/qthelp."
97106

98107
# Build Devhelp files
108+
[group: 'misc']
99109
devhelp:
100110
{{ sphinxbuild }} -b devhelp {{ allsphinxopts }} {{ builddir }}/devhelp
101111
@echo ""
102112
@echo "Build finished."
103113

104114
# Build Texinfo files
115+
[group: 'misc']
105116
texinfo:
106117
{{ sphinxbuild }} -b texinfo {{ allsphinxopts }} {{ builddir }}/texinfo
107118
@echo ""
108119
@echo "Build finished. The Texinfo files are in {{ builddir }}/texinfo."
109120

110121
# Build Info files from Texinfo
122+
[group: 'misc']
111123
info:
112124
{{ sphinxbuild }} -b texinfo {{ allsphinxopts }} {{ builddir }}/texinfo
113125
@echo "Running Texinfo files through makeinfo..."
114126
make -C {{ builddir }}/texinfo info
115127
@echo "makeinfo finished; the Info files are in {{ builddir }}/texinfo."
116128

117129
# Build gettext catalogs
130+
[group: 'misc']
118131
gettext:
119132
{{ sphinxbuild }} -b gettext {{ sphinxopts }} . {{ builddir }}/locale
120133
@echo ""
121134
@echo "Build finished. The message catalogs are in {{ builddir }}/locale."
122135

123-
# ============================================================================
124-
# Validation
125-
# ============================================================================
126-
127136
# Check all external links
137+
[group: 'validate']
128138
linkcheck:
129139
{{ sphinxbuild }} -b linkcheck {{ allsphinxopts }} {{ builddir }}/linkcheck
130140
@echo ""
131141
@echo "Link check complete; look for any errors in the above output or in {{ builddir }}/linkcheck/output.txt."
132142

133143
# Run doctests embedded in documentation
144+
[group: 'validate']
134145
doctest:
135146
{{ sphinxbuild }} -b doctest {{ allsphinxopts }} {{ builddir }}/doctest
136147
@echo "Testing of doctests in the sources finished, look at the results in {{ builddir }}/doctest/output.txt."
137148

138149
# Check build from scratch
150+
[group: 'validate']
139151
checkbuild:
140152
rm -rf {{ builddir }}
141153
{{ sphinxbuild }} -n -q ./ {{ builddir }}
142154

143155
# Build redirects configuration
156+
[group: 'misc']
144157
redirects:
145158
{{ sphinxbuild }} -b rediraffewritediff {{ allsphinxopts }} {{ builddir }}/redirects
146159
@echo ""
147160
@echo "Build finished. The redirects are in rediraffe_redirects."
148161

149162
# Show changes overview
163+
[group: 'misc']
150164
changes:
151165
{{ sphinxbuild }} -b changes {{ allsphinxopts }} {{ builddir }}/changes
152166
@echo ""
153167
@echo "The overview file is in {{ builddir }}/changes."
154168

155-
# ============================================================================
156-
# Development
157-
# ============================================================================
158-
159169
# Watch files and rebuild on change
170+
[group: 'dev']
160171
watch:
161172
#!/usr/bin/env bash
162173
set -euo pipefail
@@ -167,6 +178,7 @@ watch:
167178
fi
168179

169180
# Serve documentation via Python http.server
181+
[group: 'dev']
170182
serve:
171183
@echo '=============================================================='
172184
@echo ''
@@ -176,16 +188,19 @@ serve:
176188
python -m http.server {{ http_port }} --directory {{ builddir }}/html
177189

178190
# Watch and serve simultaneously
191+
[group: 'dev']
179192
dev:
180193
#!/usr/bin/env bash
181194
set -euo pipefail
182195
just watch &
183196
just serve
184197

185198
# Start sphinx-autobuild server
199+
[group: 'dev']
186200
start:
187201
uv run sphinx-autobuild "{{ sourcedir }}" "{{ builddir }}" {{ sphinxopts }} --port {{ http_port }}
188202

189203
# Design mode: watch static files and disable incremental builds
204+
[group: 'dev']
190205
design:
191206
uv run sphinx-autobuild "{{ sourcedir }}" "{{ builddir }}" {{ sphinxopts }} --port {{ http_port }} --watch "." -a

justfile

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@ doc_files := "find . -type f -not -path '*/\\.*' | grep -i '.*[.]rst$\\|.*[.]md$
1111
default:
1212
@just --list
1313

14-
# ============================================================================
15-
# Testing
16-
# ============================================================================
17-
1814
# Run tests with pytest
15+
[group: 'test']
1916
test *args:
2017
uv run py.test {{ args }}
2118

2219
# Run tests then start continuous testing with pytest-watcher
20+
[group: 'test']
2321
start:
2422
just test
2523
uv run ptw .
2624

2725
# Watch files and run tests on change (requires entr)
26+
[group: 'test']
2827
watch-test:
2928
#!/usr/bin/env bash
3029
set -euo pipefail
@@ -35,15 +34,13 @@ watch-test:
3534
just _entr-warn
3635
fi
3736

38-
# ============================================================================
39-
# Documentation
40-
# ============================================================================
41-
4237
# Build documentation
38+
[group: 'docs']
4339
build-docs:
4440
just -f docs/justfile html
4541

4642
# Watch files and rebuild docs on change
43+
[group: 'docs']
4744
watch-docs:
4845
#!/usr/bin/env bash
4946
set -euo pipefail
@@ -55,37 +52,40 @@ watch-docs:
5552
fi
5653

5754
# Serve documentation
55+
[group: 'docs']
5856
serve-docs:
5957
just -f docs/justfile serve
6058

6159
# Watch and serve docs simultaneously
60+
[group: 'docs']
6261
dev-docs:
6362
#!/usr/bin/env bash
6463
set -euo pipefail
6564
just watch-docs &
6665
just serve-docs
6766

6867
# Start documentation server with auto-reload
68+
[group: 'docs']
6969
start-docs:
7070
just -f docs/justfile start
7171

7272
# Start documentation design mode (watches static files)
73+
[group: 'docs']
7374
design-docs:
7475
just -f docs/justfile design
7576

76-
# ============================================================================
77-
# Linting & Formatting
78-
# ============================================================================
79-
8077
# Format code with ruff
78+
[group: 'lint']
8179
ruff-format:
8280
uv run ruff format .
8381

8482
# Run ruff linter
83+
[group: 'lint']
8584
ruff:
8685
uv run ruff check .
8786

8887
# Watch files and run ruff on change
88+
[group: 'lint']
8989
watch-ruff:
9090
#!/usr/bin/env bash
9191
set -euo pipefail
@@ -97,14 +97,17 @@ watch-ruff:
9797
fi
9898

9999
# Run vulture to find dead code
100+
[group: 'lint']
100101
vulture:
101102
uv run vulture cihai_cli
102103

103104
# Run mypy type checker
105+
[group: 'lint']
104106
mypy:
105107
uv run mypy $(${{ py_files }})
106108

107109
# Watch files and run mypy on change
110+
[group: 'lint']
108111
watch-mypy:
109112
#!/usr/bin/env bash
110113
set -euo pipefail
@@ -116,25 +119,20 @@ watch-mypy:
116119
fi
117120

118121
# Format markdown files with prettier
122+
[group: 'format']
119123
format-markdown:
120124
prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES
121125

122-
# ============================================================================
123-
# Typing
124-
# ============================================================================
125-
126126
# Run monkeytype to collect runtime types
127+
[group: 'typing']
127128
monkeytype-create:
128129
uv run monkeytype run $(uv run which py.test)
129130

130131
# Apply collected monkeytype annotations
132+
[group: 'typing']
131133
monkeytype-apply:
132134
uv run monkeytype list-modules | xargs -n1 -I{} sh -c 'uv run monkeytype apply {}'
133135

134-
# ============================================================================
135-
# Private helpers
136-
# ============================================================================
137-
138136
[private]
139137
_entr-warn:
140138
@echo "----------------------------------------------------------"

0 commit comments

Comments
 (0)