Debian Codegraph @

justfile

raw
1 # justfile for libtmux
2 # https://just.systems/
3
4 set shell := ["bash", "-uc"]
5
6 # File patterns
7 py_files := "find . -type f -not -path '*/\\.*' | grep -i '.*[.]py$' 2> /dev/null"
8 doc_files := "find . -type f -not -path '*/\\.*' | grep -i '.*[.]rst$\\|.*[.]md$\\|.*[.]css$\\|.*[.]py$\\|mkdocs\\.yml\\|CHANGES\\|TODO\\|.*conf\\.py' 2> /dev/null"
9 all_files := "find . -type f -not -path '*/\\.*' | grep -i '.*[.]py$\\|.*[.]rst$\\|.*[.]md$\\|.*[.]css$\\|.*[.]py$\\|mkdocs\\.yml\\|CHANGES\\|TODO\\|.*conf\\.py' 2> /dev/null"
10
11 # List all available commands
12 default:
13 @just --list
14
15 # Run tests with pytest
16 [group: 'test']
17 test *args:
18 uv run py.test {{ args }}
19
20 # Run tests then start continuous testing with pytest-watcher
21 [group: 'test']
22 start:
23 just test
24 uv run ptw .
25
26 # Watch files and run tests on change (requires entr)
27 [group: 'test']
28 watch-test:
29 #!/usr/bin/env bash
30 set -euo pipefail
31 if command -v entr > /dev/null; then
32 {{ all_files }} | entr -c just test
33 else
34 just test
35 just _entr-warn
36 fi
37
38 # Build documentation
39 [group: 'docs']
40 build-docs:
41 just -f docs/justfile html
42
43 # Watch files and rebuild docs on change
44 [group: 'docs']
45 watch-docs:
46 #!/usr/bin/env bash
47 set -euo pipefail
48 if command -v entr > /dev/null; then
49 {{ doc_files }} | entr -c just build-docs
50 else
51 just build-docs
52 just _entr-warn
53 fi
54
55 # Serve documentation
56 [group: 'docs']
57 serve-docs:
58 just -f docs/justfile serve
59
60 # Watch and serve docs simultaneously
61 [group: 'docs']
62 dev-docs:
63 #!/usr/bin/env bash
64 set -euo pipefail
65 just watch-docs &
66 just serve-docs
67
68 # Start documentation server with auto-reload
69 [group: 'docs']
70 start-docs:
71 just -f docs/justfile start
72
73 # Start documentation design mode (watches static files)
74 [group: 'docs']
75 design-docs:
76 just -f docs/justfile design
77
78 # Format code with ruff
79 [group: 'lint']
80 ruff-format:
81 uv run ruff format .
82
83 # Run ruff linter
84 [group: 'lint']
85 ruff:
86 uv run ruff check .
87
88 # Watch files and run ruff on change
89 [group: 'lint']
90 watch-ruff:
91 #!/usr/bin/env bash
92 set -euo pipefail
93 if command -v entr > /dev/null; then
94 {{ py_files }} | entr -c just ruff
95 else
96 just ruff
97 just _entr-warn
98 fi
99
100 # Run mypy type checker
101 [group: 'lint']
102 mypy:
103 uv run mypy $({{ py_files }})
104
105 # Watch files and run mypy on change
106 [group: 'lint']
107 watch-mypy:
108 #!/usr/bin/env bash
109 set -euo pipefail
110 if command -v entr > /dev/null; then
111 {{ py_files }} | entr -c just mypy
112 else
113 just mypy
114 just _entr-warn
115 fi
116
117 # Format markdown files with prettier
118 [group: 'format']
119 format-markdown:
120 prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES
121
122 # Run monkeytype to collect runtime types
123 [group: 'typing']
124 monkeytype-create:
125 uv run monkeytype run $(uv run which py.test)
126
127 # Apply collected monkeytype annotations
128 [group: 'typing']
129 monkeytype-apply:
130 uv run monkeytype list-modules | xargs -n1 -I{} sh -c 'uv run monkeytype apply {}'
131
132 [private]
133 _entr-warn:
134 @echo "----------------------------------------------------------"
135 @echo " ! File watching functionality non-operational ! "
136 @echo " "
137 @echo "Install entr(1) to automatically run tasks on file change."
138 @echo "See https://eradman.com/entrproject/ "
139 @echo "----------------------------------------------------------"