-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (46 loc) · 2.28 KB
/
Copy pathMakefile
File metadata and controls
61 lines (46 loc) · 2.28 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
PYTHON_VERSION = python3.12
VENV = .venv
UV := $(shell command -v uv 2>/dev/null)
ifdef UV
INSTALL = uv pip install --python $(VENV)/bin/python
else
INSTALL = $(VENV)/bin/pip install
endif
.DEFAULT_GOAL := help
.PHONY: help init update-hooks reset-venv rebuild test format lint docs docs-serve docs-draft clean
help: ## List targets
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?##/ {printf " %-24s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
$(VENV)/bin/python:
$(PYTHON_VERSION) -m venv $(VENV)
init: $(VENV)/bin/python ## Create the development environment and install git hooks
@$(VENV)/bin/pip install --upgrade pip --quiet
$(INSTALL) -e .[dev] --quiet
@$(VENV)/bin/pre-commit install --hook-type pre-commit --hook-type commit-msg
update-hooks: ## Bump hook revisions in .pre-commit-config.yaml
@$(VENV)/bin/pre-commit autoupdate
reset-venv: ## Delete the environment
rm -rf $(VENV)
rebuild: ## Rebuild the Rust extension
$(INSTALL) -e . --quiet --no-deps
test: rebuild ## Run Rust and Python tests
cargo test --manifest-path crates/Cargo.toml --locked --all-targets
$(VENV)/bin/pytest tests
format: ## Format Rust and Python in place
cargo fmt --manifest-path crates/Cargo.toml
$(VENV)/bin/pre-commit run --all-files
lint: ## Check formatting, clippy, and ruff without changing anything
cargo fmt --manifest-path crates/Cargo.toml --check
cargo clippy --manifest-path crates/Cargo.toml --all-targets --all-features -- -D warnings
$(VENV)/bin/ruff check src tests docs
$(VENV)/bin/ruff format --check src tests docs
docs: rebuild ## Run the doc examples and build docs/_build/html
@rm -rf docs/_build/html docs/_build/jupyter_execute
$(VENV)/bin/sphinx-build -b html -W --keep-going docs docs/_build/html
docs-serve: rebuild ## Serve docs at http://localhost:8000/ and rebuild on every edit
$(VENV)/bin/sphinx-autobuild --port 8000 docs docs/_build/html
docs-draft: rebuild ## Like docs-serve, but examples are shown unexecuted
DOCS_NOEXEC=1 $(VENV)/bin/sphinx-autobuild --port 8000 docs docs/_build/draft
clean: ## Remove build artifacts and caches
rm -rf build dist src/*.egg-info .pytest_cache .ruff_cache crates/target \
docs/_build docs/apidocs/stubs src/*/_accelerate*.so src/*/_accelerate*.pyd
find src tests docs -name __pycache__ -type d -prune -exec rm -rf {} +