-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
132 lines (104 loc) · 3.1 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
123
124
125
126
127
128
129
130
131
132
PYTHON := "python -X dev"
_default:
@just --list
# {{{ formatting
alias fmt: format
[doc("Reformat all source code")]
format: isort black pyproject justfmt
[doc("Run ruff isort fixes over the source code")]
isort:
ruff check --fix --select=I src test
ruff check --fix --select=RUF022 src
@echo -e "\e[1;32mruff isort clean!\e[0m"
[doc("Run ruff format over the source code")]
black:
ruff format src test
@echo -e "\e[1;32mruff format clean!\e[0m"
[doc("Run pyproject-fmt over the configuration")]
pyproject:
{{ PYTHON }} -m pyproject_fmt \
--indent 4 --max-supported-python "3.13" \
pyproject.toml
@echo -e "\e[1;32mpyproject clean!\e[0m"
[doc("Run just --fmt over the justfiles")]
justfmt:
just --unstable --fmt
@echo -e "\e[1;32mjust --fmt clean!\e[0m"
# }}}
# {{{ linting
[doc("Run all linting checks over the source code")]
lint: typos reuse ruff mypy
[doc("Run typos over the source code and documentation")]
typos format="brief":
typos --sort --format={{ format }}
@echo -e "\e[1;32mtypos clean!\e[0m"
[doc("Check REUSE license compliance")]
reuse:
{{ PYTHON }} -m reuse lint
@echo -e "\e[1;32mREUSE compliant!\e[0m"
[doc("Run ruff checks over the source code")]
ruff:
ruff check src test
@echo -e "\e[1;32mruff clean!\e[0m"
[doc("Run mypy checks over the source code")]
mypy:
{{ PYTHON }} -m mypy src
@echo -e "\e[1;32mmypy clean!\e[0m"
# }}}
# {{{ pin
[private]
requirements_build_txt:
uv pip compile --upgrade --universal --python-version "3.10" \
-o requirements-build.txt requirements-build.in
[private]
requirements_dev_txt:
uv pip compile --upgrade --universal --python-version "3.10" \
--extra dev \
-o requirements-dev.txt pyproject.toml
[private]
requirements_txt:
uv pip compile --upgrade --universal --python-version "3.10" \
-o requirements.txt pyproject.toml
[doc("Pin dependency versions to requirements.txt")]
pin: requirements_txt requirements_dev_txt requirements_build_txt
# }}}
# {{{ develop
[doc("Install project in editable mode")]
develop:
@rm -rf build
@rm -rf dist
{{ PYTHON }} -m pip install \
--verbose \
--no-build-isolation \
--editable .
[doc("Editable install using pinned dependencies from requirements-dev.txt")]
pip-install:
{{ PYTHON }} -m pip install --verbose --requirement requirements-build.txt
{{ PYTHON }} -m pip install \
--verbose \
--requirement requirements-dev.txt \
--no-build-isolation \
--editable .
[doc("Remove various build artifacts")]
clean:
rm -rf *.png
rm -rf build dist
[doc("Remove various temporary files and caches")]
purge: clean
rm -rf .ruff_cache .pytest_cache .pytest-cache .mypy_cache tags
[doc("Regenerate ctags")]
ctags:
ctags --recurse=yes \
--tag-relative=yes \
--exclude=.git \
--exclude=docs \
--python-kinds=-i \
--language-force=python
# }}}
# {{{ tests
[doc("Run pytest tests")]
test *PYTEST_ADDOPTS:
{{ PYTHON }} -m pytest \
--junit-xml=pytest-results.xml \
{{ PYTEST_ADDOPTS }}
# }}}