-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathjustfile
More file actions
151 lines (127 loc) · 3.5 KB
/
justfile
File metadata and controls
151 lines (127 loc) · 3.5 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
# List available recipes.
help:
@just --list
# Set up Git precommit hooks for this project (recommended).
[group('setup')]
install-precommit:
@uv run pre-commit install
# Compiles the Rust code for development.
[group('testing')]
compile:
@uv run maturin develop
# Compiles Rust, then runs Rust and Python tests.
[group('testing')]
compile-and-test:
@just compile
@just test-rust
@just test-python
# Runs the Rust tests.
[group('testing')]
[working-directory: 'rust']
test-rust:
@cargo test --no-default-features
# Runs Python tests.
[group('testing')]
test-python $UV_PYTHON=env("UV_PYTHON", ""):
@uv run pytest --benchmark-skip
# Runs tests under all supported Python versions, plus Rust.
[group('testing')]
test-all:
just test-python 3.10
just test-python 3.11
just test-python 3.12
just test-python 3.13
just test-python 3.14
just test-rust
# Populate missing Syrupy snapshots.
[group('testing')]
update-snapshots:
@uv run pytest --snapshot-update --benchmark-skip
# Format the Rust code.
[group('formatting')]
[working-directory: 'rust']
format-rust:
@cargo fmt
@echo 'Formatted Rust code.'
# Format the Python code.
[group('formatting')]
format-python:
@uv run ruff format
@echo 'Formatted Python code.'
# Format all code.
[group('formatting')]
format:
@just format-rust
@just format-python
# Lint Python code.
[group('linting')]
lint-python:
@echo 'Running ruff format...'
@uv run ruff format --check
@echo 'Running ruff check...'
@uv run ruff check
@echo 'Running mypy...'
@uv run mypy src/grimp tests
@echo 'Running Import Linter...'
@uv run lint-imports
# Lint Rust code using cargo fmt and clippy.
[working-directory: 'rust']
[group('linting')]
lint-rust:
@cargo fmt --check
@cargo clippy --all-targets --all-features -- -D warnings
# Attempt to fix any clippy errors.
[working-directory: 'rust']
[group('linting')]
autofix-rust:
@cargo clippy --all-targets --all-features --fix --allow-staged --allow-dirty
@just format-rust
# Fix any ruff errors.
[group('linting')]
autofix-python:
@uv run ruff check --fix
@just format-python
# Fix any lint errors.
[group('linting')]
autofix:
@just autofix-rust
@just autofix-python
# Run linters.
[group('linting')]
lint:
@echo 'Linting Python...'
@just lint-python
@echo 'Linting Rust...'
@just lint-rust
@echo ''
@echo '👍 {{GREEN}} Linting all good.{{NORMAL}}'
# Build docs.
[group('docs')]
build-docs:
@uv run --group=docs sphinx-build -b html docs dist/docs --fail-on-warning --fresh-env --quiet
# Build docs and open in browser.
[group('docs')]
build-and-open-docs:
@just build-docs
@open dist/docs/index.html
# Run benchmarks locally using pytest-benchmark.
[group('benchmarking')]
benchmark-local:
@uv run pytest --benchmark-only --benchmark-autosave
@just show-benchmark-results
# Show recent local benchmark results.
[group('benchmarking')]
show-benchmark-results:
@uv run pytest-benchmark compare --group-by=fullname --sort=name --columns=mean
# Run benchmarks using Codspeed. This only works in CI.
[group('benchmarking')]
benchmark-ci:
@uv run --group=benchmark-ci pytest --codspeed
# Run all linters, build docs and tests. Worth running before pushing to Github.
[group('prepush')]
full-check:
@just lint
@just build-docs
@just test-all
@echo '👍 {{GREEN}} Linting, docs and tests all good.{{NORMAL}}'
set windows-shell := ["powershell.exe", "-NoProfile", "-NoLogo", "-Command"]