-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
185 lines (149 loc) · 5.72 KB
/
Justfile
File metadata and controls
185 lines (149 loc) · 5.72 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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
TESTDIR := "tests"
PROJECTCACHE := ".cache"
COV_HTML_DIR := "{{PROJECTCACHE}}/coverage/coverage_html"
COVERAGE_ARGS := "--cov --cov-config=pyproject.toml --cov-report=term:skip-covered --cov-report=html"
COVERAGE_ARGS_ := "--cov=datethyme --cov-config=pyproject.toml --cov-report=term:skip-covered --cov-fail-under=0 --cov-report=html:codeqa/coverage/html"
TESTMON_PREFIX := 'TESTMON_DATAFILE=".cache/testmondata"'
PROFILING_ARGS := ""
PROFILING_ARGS_ := "--profile --profile-svg --pstats-dir .cache/prof --element-number 0"
TEST_CFG_ARG := "--config-file=pyproject.toml"
TESTMON_ARGS := "--testmon --testmon-forceselect --no-cov"
STOP_FORWARDING := "python ./codeqa/scripts/stop_port_forwarding.py"
TIMESTAMP := 'date +"%Y-%m-%d %H:%M:%S.%3N"'
VIEWER := "$BROWSER"
alias mypy := typecheck
alias l := lint
alias d := docs
alias tc := test-cov
alias t := test
alias flame := flamegraph
alias perf := perf-flamegraph
default:
just --list
commit:
sh codeqa/scripts/format-staged.sh
cz commit
format:
treefmt
check:
ruff check .
fix:
ruff check --fix .
typecheck path="$PWD":
mypy --cache-dir .cache/mypy_cache {{ path }}
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_mypy
ty path="$PWD":
ty check
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_ty
lint path="$PWD": format typecheck fix deal
yamllint -c codeqa/configs/yamllint.yml codeqa/ mkdocs.yml lefthook.yml
deal:
python -m deal lint
@vulture:
vulture
pydeps-full:
pydeps src/datethyme \
--noshow \
-T svg \
--show-deps \
--pylib \
-o codeqa/dependencies/pydeps/datethyme-full.svg \
--rmprefix datethyme. \
> codeqa/dependencies/pydeps/pydeps-full.json
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_pydeps_full
pydeps:
pydeps src/datethyme \
--noshow \
-T svg \
--show-deps \
-o codeqa/dependencies/pydeps/datethyme.svg \
--rmprefix datethyme. \
--cluster \
--max-module-depth 3 \
> codeqa/dependencies/pydeps/pydeps.json
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_pydeps
pydeps-simple:
pydeps src/datethyme \
--noshow \
-T svg \
--show-deps \
-o codeqa/dependencies/pydeps/datethyme-simple.svg \
--cluster \
--max-module-depth 2 \
> codeqa/dependencies/pydeps/pydeps-simple.json
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_pydeps_simple
@view-deps:
echo "Recency:"
echo " `sed 's/.\{7\}$//' <<< cat {{ PROJECTCACHE }}/last_pydeps_full`"
echo " `sed 's/.\{7\}$//' <<< cat {{ PROJECTCACHE }}/last_pydeps`"
echo " `sed 's/.\{7\}$//' <<< cat {{ PROJECTCACHE }}/last_pydeps_simple`"
{{ VIEWER }} `pwd`/codeqa/dependencies &>/dev/null
snakefood:
python -m snakefood3 src/ datethyme \
--group codeqa/dependencies/snakefood/group.txt \
> codeqa/dependencies/snakefood/datethyme.dot
sed -i 's/dpi="150",/size="25,25!",\n dpi="50",/' codeqa/dependencies/snakefood/datethyme.dot
dot -T svg \
codeqa/dependencies/snakefood/datethyme.dot \
-o codeqa/dependencies/snakefood/datethyme.svg
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_snakefood
deply:
deply analyze \
--config codeqa/dependencies/deply/deply.yaml \
--output codeqa/dependencies/deply/report.txt \
--report-format text
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_deply
bandit:
bandit -r src/datethyme/ --baseline codeqa/security/bandit/baselines/datethyme.json
bandit -r codeqa/scripts/ --baseline codeqa/security/bandit/baselines/scripts.json
bandit-html:
bandit -r src/datethyme/ --format html --output codeqa/security/bandit/datethyme.html --baseline codeqa/security/bandit/baselines/datethyme.json
bandit -r codeqa/scripts/ --format html --output codeqa/security/bandit/scripts.html --baseline codeqa/security/bandit/baselines/scripts.json
view-bandit:
{{ VIEWER }} codeqa/security/bandit
pyflame:
python -m pyflame \
--output-path codeqa/performance/pyflame/flamegraph.svg \
codeqa/scripts/wrapper_pyflame.py
flamegraph:
flamegraph -o codeqa/performance/flamegraph/flamegraph.svg -- datethyme
perf-flamegraph:
sh codeqa/scripts/perf-flamegraph.sh
scalene:
python3 -m scalene codeqa/scripts/wrapper_scalene.py --profile-all
view-flamegraphs:
{{ VIEWER }} `pwd`/codeqa/performance &>/dev/null
smoke:
pytest {{ TEST_CFG_ARG }} tests/smoke
test:
{{ TESTMON_PREFIX }} pytest {{ TEST_CFG_ARG }} {{ TESTMON_ARGS }} {{ TESTDIR }} \
|| {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test_partial \
&& {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test
unit:
{{ TESTMON_PREFIX }} pytest tests/unit {{ TEST_CFG_ARG }} {{ TESTMON_ARGS }} {{ TESTDIR }} \
|| {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test_partial \
&& {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test
test-cov:
pytest {{ TEST_CFG_ARG }} {{ COVERAGE_ARGS }} {{ TESTDIR }}/ \
|| {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test_all \
&& {{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_test
@view-cov:
echo "Recency: `sed 's/.\{7\}$//' <<< cat {{ PROJECTCACHE }}/last_test`"
{{ VIEWER }} `pwd`/codeqa/coverage/html/index.html &>/dev/null
docs:
mkdocs build
docs-lazy:
python codeqa/scripts/lazy_mkdocs.py
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_docs
serve-docs:
mkdocs serve
@view-docs:
echo "Recency: `sed 's/.\{7\}$//' <<< cat {{ PROJECTCACHE }}/last_docs`"
{{ VIEWER }} `pwd`/docs/site/index.html &>/dev/null
sbom:
uv export --format requirements.txt > requirements.txt
cyclonedx-py requirements > sbom.json
python codeqa/scripts/jsonfmt.py 4 sbom.json
{{ TIMESTAMP }} > {{ PROJECTCACHE }}/last_sbom
reqs:
uv export --format requirements-txt > requirements.txt