forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
248 lines (191 loc) · 7.19 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
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
237
238
239
240
241
242
243
244
245
246
247
248
# Install just: https://github.com/casey/just
#
# Then run `just --list` to see the available commands
export RUSTDOCFLAGS := "--deny warnings --deny rustdoc::missing_crate_level_docs"
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
default:
@just --list
### Common
# Format all of our code
format: cpp-format toml-format py-format
cargo fmt --all
# Lint all of our code
lint: toml-lint py-lint rs-lint
# Run the fast versions of our linters
fast-lint *ARGS:
pixi run fast-lint {{ARGS}}
### C and C++
# Clear the C++ build directories
cpp-clean:
rm -rf build CMakeCache.txt CMakeFiles
cpp-format:
#!/usr/bin/env bash
fd --extension h --exec clang-format -i
fd --extension hpp --exec clang-format -i
fd --extension c --exec clang-format -i
fd --extension cpp --exec clang-format -i
# Build our C++ SDK, and all our tests and examples
cpp-build-all:
pixi run cpp-build-all
# Build our C++ SDK and tests
cpp-build:
pixi run cpp-build-all
# Build all our C++ examples.
cpp-build-examples:
pixi run cpp-build-examples
# Build all our C++ snippets.
cpp-build-snippets:
pixi run cpp-build-snippets
# Run our C++ tests
cpp-test:
pixi run cpp-test
cpp-plot-dashboard *ARGS:
pixi run cpp-plot-dashboard {{ARGS}}
### Python
py_folders := "."
# Set up a Python virtual environment for development
py-dev-env:
#!/usr/bin/env bash
echo "Setting up Python virtual environment in venv"
set -euxo pipefail
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install -r scripts/requirements-dev.txt
echo "Do 'source venv/bin/activate' to use the virtual environment!"
# Set up a Python 3.10 virtual environment for development
py-dev-env-3-10:
#!/usr/bin/env bash
echo "Setting up Python 3.10 virtual environment in venv3.10"
set -euxo pipefail
python3.10 -m venv venv3.10
venv3.10/bin/pip install --upgrade pip
venv3.10/bin/pip install -r scripts/requirements-dev.txt
echo "Do 'source venv3.10/bin/activate' to use the virtual environment!"
# Run all examples with the specified args
py-run-all *ARGS:
python3 "scripts/run_all.py" {{ARGS}}
# Run all examples in the native viewer
py-run-all-native: py-run-all
# Run all examples in the web viewer
py-run-all-web:
just py-run-all --web
# Run all examples, save them to disk as rrd, then view them natively
py-run-all-rrd *ARGS:
just py-run-all --save {{ARGS}}
# Run all examples with all supported Python versions (through nox)
py-run-all-allpy *ARGS:
nox -s run_all -- {{ARGS}}
# Build and install the package into the venv
py-build *ARGS:
#!/usr/bin/env bash
set -euo pipefail
unset CONDA_PREFIX && \
maturin develop \
--manifest-path rerun_py/Cargo.toml \
--extras="tests" \
{{ARGS}}
# Run autoformatting
py-format:
#!/usr/bin/env bash
set -euo pipefail
# NOTE: we need both `ruff check --fix` and `ruff format` in that order: https://twitter.com/charliermarsh/status/1717229721954799727
ruff check --fix --config rerun_py/pyproject.toml {{py_folders}}
ruff format --config rerun_py/pyproject.toml {{py_folders}}
blackdoc {{py_folders}} # Format snippets in docstring. Hopefully `ruff` can do this soon: https://github.com/astral-sh/ruff/issues/7146
# Check that all the requirements.txt files for all the examples are correct
py-requirements:
#!/usr/bin/env bash
set -euo pipefail
find examples/python/ -name main.py | xargs -I _ sh -c 'cd $(dirname _) && echo $(pwd) && pip-missing-reqs . || exit 255'
# Run linting
py-lint:
#!/usr/bin/env bash
set -euxo pipefail
ruff check --config rerun_py/pyproject.toml {{py_folders}}
ruff format --check --config rerun_py/pyproject.toml {{py_folders}}
blackdoc --check {{py_folders}}
mypy --install-types --non-interactive --no-warn-unused-ignore
# Run fast unittests
py-test:
python -m pytest -vv -c rerun_py/pyproject.toml rerun_py/tests/unit/
# Run tests on all supported Python versions (through nox)
py-test-allpy:
nox -s tests
# Run all Python benchmarks
py-bench *ARGS:
python -m pytest -c rerun_py/pyproject.toml --benchmark-only {{ARGS}}
# Serve the python docs locally
py-docs-serve:
mkdocs serve -f rerun_py/mkdocs.yml -w rerun_py
py-plot-dashboard *ARGS:
pixi run py-plot-dashboard {{ARGS}}
### Rust
# Generate and open the documentation for Rerun and all of its Rust dependencies.
#
# `--keep-going` makes sure we don't to abort the build process in case of errors.
# This is an unstable flag, available only on nightly.
rs-doc:
cargo +nightly doc --all --open --keep-going --all-features -Zunstable-options
# `just rerun` is short a convenient shorthand, skipping the web viewer.
rerun *ARGS:
cargo run --package rerun-cli --no-default-features --features native_viewer -- {{ARGS}}
# like `just rerun`, but with --release
rerun-release *ARGS:
cargo run --package rerun-cli --no-default-features --features native_viewer --release -- {{ARGS}}
# `just rerun-web` is short a convenient shorthand for building & starting the web viewer.
rerun-web *ARGS:
cargo run --package rerun-cli --no-default-features --features web_viewer -- --web-viewer {{ARGS}}
# like `rerun-web-release`, but with --release
rerun-web-release *ARGS:
cargo run --package rerun-cli --no-default-features --features web_viewer --release -- --web-viewer {{ARGS}}
# Run the codegen. Optionally pass `--profile` argument if you want.
codegen *ARGS:
pixi run codegen {{ARGS}}
# Print the contents of an .rrd file
print *ARGS:
just rerun print {{ARGS}}
# To easily run examples on the web, see https://github.com/rukai/cargo-run-wasm.
# Temporary solution while we wait for our own xtasks!
run-wasm *ARGS:
cargo run --release --package run_wasm -- {{ARGS}}
# Lint all of Rust code
rs-lint:
#!/usr/bin/env bash
set -euxo pipefail
cargo cranky --quiet --all-features -- --deny warnings
typos
scripts/lint.py
cargo doc --quiet --no-deps --all-features
cargo doc --quiet --document-private-items --no-deps --all-features
cargo test --quiet --doc --all-features # runs all doc-tests
# Lint Rust code for the wasm target
rs-lint-wasm:
scripts/clippy_wasm.sh
# Run all examples with the specified args
rs-run-all *ARGS:
#!/usr/bin/env bash
set -euo pipefail
find examples/rust/ -name main.rs | xargs -I _ sh -c 'cd $(dirname _) && echo $(pwd) && cargo r'
rs-plot-dashboard *ARGS:
pixi run rs-plot-dashboard {{ARGS}}
### TOML
# Format .toml files
toml-format:
pixi run toml-fmt
# Lint .toml files
toml-lint:
pixi run lint-taplo
### Misc
# Update the design_tokens.json used to style the GUI.
# See https://rerun-design-guidelines.netlify.app/tokens for their meanings.
# To update the upstream `design_tokens.json`, modify
# https://github.com/rerun-io/documentation/blob/main/src/utils/tokens.ts and push to main.
download-design-tokens:
curl --fail https://rerun-docs.netlify.app/api/tokens | jq > crates/re_ui/data/design_tokens.json
# Update the results of `insta` snapshot regression tests
update-insta-tests:
cargo test; cargo insta review
upload *ARGS:
python3 "scripts/upload_image.py" {{ARGS}}
crates *ARGS:
python3 "scripts/ci/crates.py" {{ARGS}}