-
Notifications
You must be signed in to change notification settings - Fork 174
/
Makefile
75 lines (61 loc) · 2.01 KB
/
Makefile
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
.DEFAULT_GOAL := help
SHELL=/bin/bash
VENV = .venv
IS_M1 ?= 0
PYTHON_VERSION ?= python3.11
# Hypothesis
HYPOTHESIS_MAX_EXAMPLES ?= 100
HYPOTHESIS_SEED ?= 0
# TPC-DS
SCALE_FACTOR ?= 1
OUTPUT_DIR ?= data/tpc-ds/
ifeq ($(OS),Windows_NT)
VENV_BIN=$(VENV)/Scripts
else
VENV_BIN=$(VENV)/bin
endif
.venv: ## Set up virtual environment
ifeq (, $(shell which uv))
python3 -m venv $(VENV)
$(VENV_BIN)/python -m pip install --upgrade uv
else
uv venv $(VENV) -p $(PYTHON_VERSION)
endif
ifeq ($(IS_M1), 1)
## Hacks to deal with grpcio compile errors on m1 macs
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 \
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 \
CFLAGS="${CFLAGS} -I /opt/homebrew/opt/openssl/include" \
LDFLAGS="${LDFLAGS} -L /opt/homebrew/opt/openssl/lib" \
. $(VENV_BIN)/activate; uv pip install -r requirements-dev.txt
else
. $(VENV_BIN)/activate; uv pip install -r requirements-dev.txt
endif
.PHONY: check-toolchain
check-toolchain:
@TOOLCHAIN="$(shell rustup show active-toolchain)"; \
if echo "$$TOOLCHAIN" | grep -q 'rust-toolchain.toml'; \
then \
echo "Toolchain is correct, continuing with build"; \
else \
echo "Failed to build: rust using incorrect toolchain: $$TOOLCHAIN"; \
exit 1; \
fi
.PHONY: hooks
hooks: .venv
source $(VENV_BIN)/activate && pre-commit install --install-hooks
.PHONY: build
build: check-toolchain .venv ## Compile and install Daft for development
@unset CONDA_PREFIX && PYO3_PYTHON=$(VENV_BIN)/python $(VENV_BIN)/maturin develop --extras=all --uv
.PHONY: build-release
build-release: check-toolchain .venv ## Compile and install a faster Daft binary
@unset CONDA_PREFIX && PYO3_PYTHON=$(VENV_BIN)/python $(VENV_BIN)/maturin develop --release --uv
.PHONY: test
test: .venv build ## Run tests
HYPOTHESIS_MAX_EXAMPLES=$(HYPOTHESIS_MAX_EXAMPLES) $(VENV_BIN)/pytest --hypothesis-seed=$(HYPOTHESIS_SEED)
.PHONY: dsdgen
dsdgen: .venv ## Generate TPC-DS data
$(VENV_BIN)/python benchmarking/tpcds/datagen.py --scale-factor=$(SCALE_FACTOR) --tpcds-gen-folder=$(OUTPUT_DIR)
.PHONY: clean
clean:
rm -rf $(VENV)