-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjustfile
More file actions
90 lines (73 loc) · 2.77 KB
/
justfile
File metadata and controls
90 lines (73 loc) · 2.77 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
dist:
uv run python -m build --wheel
dev:
uv venv --python 3.12 --clear
uv sync --dev
uv pip install -e .
uvx pre-commit install
git config diff.ipynb.textconv "jupyter nbconvert --to script --stdout"
# Version bumping
[linux,macos]
bver:
curl -LsSf https://github.com/flaport/bver/releases/latest/download/install.sh | sh
# Version bumping
[windows]
bver:
powershell -ExecutionPolicy ByPass -c "irm https://github.com/flaport/bver/releases/latest/download/install.ps1 | iex"
# bump version
bump version="patch":
bver bump "{{ version }}"
uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
inits:
cd src/gsim && uvx mkinit --relative --recursive --write && uvx ruff format __init__.py
ipykernel:
uv run python -m ipykernel install --user --name gsim --display-name gsim
test:
uv run pytest -s -n logical --cov-report=term-missing --cov-report=html --cov-report=xml --cov=src/gsim
cov:
uv run pytest --cov=gsim --cov-report=term-missing:skip-covered --cov-report=xml
docs:
uv run mkdocs build
serve:
uv run mkdocs serve -a localhost:8080
# Run a notebook for docs (with Plotly HTML renderer): just nbrun-docs nbs/foo.ipynb
nbrun-docs +notebooks: ipykernel
for nb in {{notebooks}}; do \
PLOTLY_RENDERER=notebook_connected PYVISTA_OFF_SCREEN=true PYVISTA_JUPYTER_BACKEND=static uv run papermill "$nb" "$nb" -k gsim; \
uv run python scripts/strip_notebook_paths.py "$nb"; \
uv run jupyter nbconvert --to markdown --embed-images "$nb" --output-dir docs/nbs; \
done
# Convert notebooks to markdown for docs: just nbdocs nbs/foo.ipynb nbs/bar.ipynb
nbdocs +notebooks:
for nb in {{notebooks}}; do \
uv run jupyter nbconvert --to markdown --embed-images "$nb" --output-dir docs/nbs; \
done
nbclean-all:
find . -name "*.ipynb" -not -path "*/.ipynb_checkpoints/*" -not -path "./.venv/*" | xargs just nbclean
nbclean +filenames:
for filename in {{filenames}}; do \
uvx nbstripout "$filename"; \
uvx nb-clean clean --remove-empty-cells "$filename"; \
jq --indent 1 'del(.metadata.papermill)' "$filename" > "$filename.tmp" && mv "$filename.tmp" "$filename"; \
done
tree:
@tree -a -I .git --gitignore
clean: nbclean-all
rm -rf site
rm -rf .venv
rm -f uv.lock
rm -rf docs/nbs/*
find src -name "*.c" | xargs rm -rf
find src -name "*.pyc" | xargs rm -rf
find src -name "*.so" | xargs rm -rf
find src -name "*.pyd" | xargs rm -rf
find . -name "*.egg-info" | xargs rm -rf
find . -name ".ipynb_checkpoints" | xargs rm -rf
find . -name ".mypy_cache" | xargs rm -rf
find . -name ".pytest_cache" | xargs rm -rf
find . -name ".ruff_cache" | xargs rm -rf
find . -name "__pycache__" | xargs rm -rf
find . -name "build" | xargs rm -rf
find . -name "builds" | xargs rm -rf
find . -name "dist" -not -path "*node_modules*" | xargs rm -rf