forked from rerun-io/rerun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
126 lines (100 loc) · 3.53 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
# 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"
default:
@just --list
### Common
# Format all of our code
format: toml-format py-format
cargo fmt --all
# Lint all of our code
lint: toml-lint py-lint rs-lint
### Python
py_folders := "examples rerun_py scripts"
# Set up a Pythonvirtual 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 rerun_py/requirements-build.txt
venv/bin/pip install -r rerun_py/requirements-lint.txt
echo "Do 'source venv/bin/activate' to use the virtual environment!"
# Run all examples
py-run-all: py-build
#!/usr/bin/env bash
set -euo pipefail
fd main.py | xargs -I _ sh -c "echo _ && python3 _"
# Build and install the package into the venv
py-build *ARGS:
#!/usr/bin/env bash
set -euo pipefail
unset CONDA_PREFIX && \
source venv/bin/activate && \
maturin develop \
--manifest-path rerun_py/Cargo.toml \
--extras="tests" \
{{ARGS}}
# Run autoformatting
py-format:
#!/usr/bin/env bash
set -euxo pipefail
black --config rerun_py/pyproject.toml {{py_folders}}
blackdoc {{py_folders}}
pyupgrade --py37-plus `find rerun_py/rerun/ -name "*.py" -type f`
ruff --fix --config rerun_py/pyproject.toml {{py_folders}}
# 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
black --check --config rerun_py/pyproject.toml --diff {{py_folders}}
blackdoc --check {{py_folders}}
ruff check --config rerun_py/pyproject.toml {{py_folders}}
mypy --no-warn-unused-ignore
# Run fast unittests
py-test:
python -m pytest rerun_py/tests/unit/
# Serve the python docs locally
py-docs-serve:
mkdocs serve -f rerun_py/mkdocs.yml -w rerun_py
### 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
# 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
### TOML
# Format .toml files
toml-format:
taplo fmt
# Lint .toml files
toml-lint:
taplo fmt --check
### 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 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