-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
236 lines (184 loc) · 6.84 KB
/
Copy pathjustfile
File metadata and controls
236 lines (184 loc) · 6.84 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/usr/bin/env just --justfile
# 'justfile'
# just-repo: https://github.com/casey/just
# just-docs: https://just.systems/man/en/
@_default:
just --list --unsorted
# run ry.dev python repl
repl:
uv run python -m ry.dev
# dev run build + tests
dev: develop test
# uv sync
sync:
uv sync --inexact
# maturin develop
develop:
uv run maturin develop --profile fast-build --features "mimalloc"
# maturin develop (shorthand)
mat *ARGS:
uv run maturin develop --uv {{ ARGS }}
# cargo test
cargo-test:
cargo test
# build
build: cargo-test
uv run maturin build
# build release
build-release:
uv run maturin build --release --features "mimalloc"
# maturin develop release
devrel:
uv run maturin develop --release --features "mimalloc" --uv
# run pytest
doctest:
uv run pytest --benchmark-skip --doctest-modules --doctest-glob="*.pyi" python
# run pytest
pytest +ARGS='python tests':
uv run pytest --benchmark-skip --doctest-modules --doctest-glob="*.pyi" {{ ARGS }}
# run pytest (printing captured output)
pytestv:
uv run pytest --benchmark-skip -rP
# run all test
test: pytest
# test ry package
test-release: build-release
uv run pytest
# benchmark ry python package
bench: build-release
uv run pytest -vv
# ci rust checks
ci:
cargo fmt -- --check
cargo clippy --all-targets --features mimalloc -- -D warnings
cargo test
# ===========================================================================
# FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT ~ FMT
# ===========================================================================
# cargo format
cargo-fmt:
cargo +nightly fmt --all -- --unstable-features --config group_imports=StdExternalCrate,imports_granularity=Module,reorder_imports=true
cargo fmt --all
# cargo format check
cargo-fmtc:
cargo fmt --all -- --check
# ruff check sorting of '__all__'
sort-all-check:
uv run ruff check . --select RUF022 --preview --output-format=full
# ruff sort '__all__'
sort-all:
uv run ruff check . --select RUF022 --preview --output-format=full --fix
# ruff format
ruff-fmt:
uv run ruff format .
uv run ruff check --select "I" --show-fixes --fix .
# ruff format check
ruff-fmtc:
uv run ruff format . --check
# python format
fmtpy: sort-all ruff-fmt
# python format check
fmtcpy: sort-all-check ruff-fmtc
# justfile format
justfilefmt:
just --fmt --unstable
# justfile format check
justfilefmtc:
just --check --fmt --unstable
# format markdown
mdfmt:
pnpm dlx prettier@latest --cache --prose-wrap=always -w CHANGELOG.md
# pyproject-fmt
pyprojectfmt:
uvx pyproject-fmt . --keep-full-version
# format
fmt: cargo-fmt fmtpy justfilefmt mdfmt
# format check
fmtc: cargo-fmtc fmtcpy justfilefmtc
# ==========================================================================
# LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT ~ LINT
# ==========================================================================
# run ruff linter
ruff:
uv run ruff check .
# run ruff + fix
ruffix:
uv run ruff check . --fix --show-fixes
# run clippy
clippy:
cargo clippy --all-targets --features mimalloc -- -W warnings
# run clippy with feature-powerset via cargo-hack
clippy-features:
cargo hack --feature-powerset clippy --package ryo3-bytes
cargo hack --feature-powerset clippy --package ryo3-fspath
cargo hack --feature-powerset clippy --package ryo3-http
cargo hack --feature-powerset clippy --package ryo3-jiff
cargo hack --feature-powerset clippy --package ryo3-std
cargo hack --feature-powerset clippy --package ryo3-tokio
cargo hack --feature-powerset clippy --exclude-no-default-features --package ryo3-tokio-websockets
cargo hack --feature-powerset clippy --package ryo3-twox-hash
cargo hack --feature-powerset clippy --package ryo3-ulid
cargo hack --feature-powerset clippy --package ryo3-url
cargo hack --feature-powerset clippy --package ryo3-uuid
cargo hack --feature-powerset clippy --package ryo3-which
cargo hack --feature-powerset clippy --package ryo3-serde
cargo hack --feature-powerset clippy --exclude-no-default-features -F ring --package ryo3-reqwest
# run cargo check with feature-powerset via cargo-hack
check-features:
cargo hack --feature-powerset check --package ryo3-bytes
cargo hack --feature-powerset check --package ryo3-fspath
cargo hack --feature-powerset check --package ryo3-http
cargo hack --feature-powerset check --package ryo3-jiff
cargo hack --feature-powerset check --package ryo3-std
cargo hack --feature-powerset check --package ryo3-tokio
cargo hack --feature-powerset check --package ryo3-tokio-websockets
cargo hack --feature-powerset check --package ryo3-twox-hash
cargo hack --feature-powerset check --package ryo3-ulid
cargo hack --feature-powerset check --package ryo3-url
cargo hack --feature-powerset check --package ryo3-uuid
cargo hack --feature-powerset check --package ryo3-which
cargo hack --feature-powerset check --package ryo3-serde
cargo hack --feature-powerset check --exclude-no-default-features -F ring --package ryo3-reqwest
# lint python and rust
lint: ruff clippy
# =====================================================================
# TYPECHECK ~ TYPECHECK ~ TYPECHECK ~ TYPECHECK ~ TYPECHECK ~ TYPECHECK
# =====================================================================
# run mypy type checker
mypy:
uv run mypy --version
uv run mypy python/ry tests/ examples/ scripts/
# run pyright
pyright:
pyright
# =====================================================================
# PYTHON ~ PYTHON ~ PYTHON ~ PYTHON ~ PYTHON ~ PYTHON ~ PYTHON ~ PYTHON
# =====================================================================
# pip compile requirements
pip-compile:
uv pip compile requirements.dev.in -n > requirements.dev.txt
_gen_init:
uv run python scripts/gen.py > python/ry/__init__.py
_gen-py: _gen_init fmtpy
# generate code tasks
gen: _gen-py
# =====================================================================
# docs
# =====================================================================
# generate cargo docs for all crates (in workspace)
cargo-doc:
cargo doc --no-deps --workspace
# generate depgraph for docs
depgraph-svg:
uv run python scripts/dep-graph-mmd.py | mmdc -i - -o docs/src/assets/dep-graph.svg -t dark -b transparent
# =====================================================================
# CLEAN ~ CLEAN ~ CLEAN ~ CLEAN ~ CLEAN ~ CLEAN ~ CLEAN ~ CLEAN ~ CLEAN
# =====================================================================
# clean out local caches/artifacts/stuff
clean:
cargo clean
rm -rfv .mypy_cache .venv .pytest_cache
find . -name "__pycache__" | xargs -n1 -t rm -frv
find . -name '*.py[co]' | xargs -n1 -t rm -fv
find . -name '*~' | xargs -n1 -t rm -fv
find . -name '.*~' | xargs -n1 -t rm -fv