forked from pola-rs/polars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
117 lines (95 loc) · 4.29 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
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
.DEFAULT_GOAL := help
PYTHONPATH=
SHELL=/bin/bash
VENV=.venv
ifeq ($(OS),Windows_NT)
VENV_BIN=$(VENV)/Scripts
else
VENV_BIN=$(VENV)/bin
endif
# Define command to filter pip warnings when running maturin
FILTER_PIP_WARNINGS=| grep -v "don't match your environment"; test $${PIPESTATUS[0]} -eq 0
.venv: ## Set up Python virtual environment and install requirements
python3 -m venv $(VENV)
$(MAKE) requirements
.PHONY: requirements
requirements: .venv ## Install/refresh Python project requirements
$(VENV_BIN)/python -m pip install --upgrade pip
$(VENV_BIN)/pip install --upgrade -r py-polars/requirements-dev.txt
$(VENV_BIN)/pip install --upgrade -r py-polars/requirements-lint.txt
$(VENV_BIN)/pip install --upgrade -r py-polars/docs/requirements-docs.txt
$(VENV_BIN)/pip install --upgrade -r docs/requirements.txt
.PHONY: build
build: .venv ## Compile and install Python Polars for development
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml \
$(FILTER_PIP_WARNINGS)
.PHONY: build-debug-opt
build-debug-opt: .venv ## Compile and install Python Polars with minimal optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile opt-dev \
$(FILTER_PIP_WARNINGS)
.PHONY: build-debug-opt-subset
build-debug-opt-subset: .venv ## Compile and install Python Polars with minimal optimizations turned on and no default features
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --no-default-features --profile opt-dev \
$(FILTER_PIP_WARNINGS)
.PHONY: build-opt
build-opt: .venv ## Compile and install Python Polars with nearly full optimization on and debug assertions turned off, but with debug symbols on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile debug-release \
$(FILTER_PIP_WARNINGS)
.PHONY: build-release
build-release: .venv ## Compile and install a faster Python Polars binary with full optimizations
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --release \
$(FILTER_PIP_WARNINGS)
.PHONY: build-native
build-native: .venv ## Same as build, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml -- -C target-cpu=native \
$(FILTER_PIP_WARNINGS)
.PHONY: build-debug-opt-native
build-debug-opt-native: .venv ## Same as build-debug-opt, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile opt-dev -- -C target-cpu=native \
$(FILTER_PIP_WARNINGS)
.PHONY: build-opt-native
build-opt-native: .venv ## Same as build-opt, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --profile debug-release -- -C target-cpu=native \
$(FILTER_PIP_WARNINGS)
.PHONY: build-release-native
build-release-native: .venv ## Same as build-release, except with native CPU optimizations turned on
@unset CONDA_PREFIX && source $(VENV_BIN)/activate \
&& maturin develop -m py-polars/Cargo.toml --release -- -C target-cpu=native \
$(FILTER_PIP_WARNINGS)
.PHONY: check
check: ## Run cargo check with all features
cargo clippy --workspace --all-targets --all-features
.PHONY: clippy
clippy: ## Run clippy with all features
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -D clippy::dbg_macro
.PHONY: clippy-default
clippy-default: ## Run clippy with default features
cargo clippy --all-targets --locked -- -D warnings -D clippy::dbg_macro
.PHONY: fmt
fmt: ## Run autoformatting and linting
$(VENV_BIN)/ruff check
$(VENV_BIN)/ruff format
cargo fmt --all
dprint fmt
$(VENV_BIN)/typos
.PHONY: pre-commit
pre-commit: fmt clippy clippy-default ## Run all code quality checks
.PHONY: clean
clean: ## Clean up caches and build artifacts
@rm -rf .venv/
@rm -rf target/
@rm -f Cargo.lock
@cargo clean
@$(MAKE) -s -C py-polars/ $@
.PHONY: help
help: ## Display this help screen
@echo -e "\033[1mAvailable commands:\033[0m"
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-22s\033[0m %s\n", $$1, $$2}' | sort