forked from delta-io/delta-rs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
103 lines (86 loc) · 3.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
.DEFAULT_GOAL := help
PACKAGE_VERSION := $(shell grep version Cargo.toml | head -n 1 | awk '{print $$3}' | tr -d '"' )
DAT_VERSION := 0.0.2
.PHONY: setup
setup: ## Setup the requirements
$(info --- Setup dependencies ---)
uv sync --no-install-project --all-extras
.PHONY: setup-dat
setup-dat: ## Download DAT test files
mkdir -p dat-data
rm -rf dat-data/v$(DAT_VERSION)
curl -L --silent --output dat-data/deltalake-dat-v$(DAT_VERSION).tar.gz \
https://github.com/delta-incubator/dat/releases/download/v$(DAT_VERSION)/deltalake-dat-v$(DAT_VERSION).tar.gz
tar --no-same-permissions -xzf dat-data/deltalake-dat-v$(DAT_VERSION).tar.gz
mv out dat-data/v$(DAT_VERSION)
rm dat-data/deltalake-dat-v$(DAT_VERSION).tar.gz
.PHONY: build
build: setup ## Build Python binding of delta-rs
$(info --- Build Python binding ---)
uvx --from 'maturin[zig]' maturin build $(MATURIN_EXTRA_ARGS)
.PHONY: develop
develop: setup ## Install Python binding of delta-rs
$(info --- Develop with Python binding ---)
uvx --from 'maturin[zig]' maturin develop $(MATURIN_EXTRA_ARGS)
.PHONY: install
install: build ## Install Python binding of delta-rs
$(info --- Uninstall Python binding ---)
uv pip uninstall deltalake
$(info --- Install Python binding ---)
$(eval TARGET_WHEEL := $(shell ls ../target/wheels/deltalake-${PACKAGE_VERSION}-*.whl))
uv pip install $(TARGET_WHEEL)[pandas]
.PHONY: develop-pyspark
develop-pyspark:
uv sync --all-extras --group pyspark --no-install-project
$(info --- Develop with Python binding ---)
uvx --from 'maturin[zig]' maturin develop --extras=pandas $(MATURIN_EXTRA_ARGS)
.PHONY: format
format: ## Format the code
$(info --- Rust format ---)
cargo fmt
$(info --- Python format ---)
uv run --no-sync ruff check . --fix
uv run --no-sync ruff format .
.PHONY: check-rust
check-rust: ## Run check on Rust
$(info --- Check Rust clippy ---)
cargo clippy
$(info --- Check Rust format ---)
cargo fmt -- --check
.PHONY: check-python
check-python: ## Run check on Python
$(info Check Python format)
uv run --no-sync ruff format --check --diff .
$(info Check Python linting)
uv run --no-sync ruff check .
$(info Check Python mypy)
uv run --no-sync mypy
.PHONY: unit-test
unit-test: ## Run unit test
$(info --- Run Python unit-test ---)
uv run --no-sync pytest --doctest-modules
.PHONY: test-cov
test-cov: ## Create coverage report
$(info --- Run Python unit-test ---)
uv run --no-sync pytest --doctest-modules --cov --cov-config=pyproject.toml --cov-report=term --cov-report=html
.PHONY: test-pyspark
test-pyspark:
uv run --no-sync pytest -m 'pyspark and integration'
.PHONY: build-documentation
build-documentation: ## Build documentation with Sphinx
$(info --- Run build of the Sphinx documentation ---)
uv run --no-sync sphinx-build -Wn -b html -d ./docs/build/doctrees ./docs/source ./docs/build/html
.PHONY: build-docs
build-docs: ## Build documentation with mkdocs
$(info --- Run build of the documentation ---)
(cd ..; uv pip install -r docs/requirements.txt; mkdocs build)
.PHONY: clean
clean: ## Run clean
$(warning --- Clean virtualenv and target directory ---)
cargo clean
# Remove uv's venv
rm -rf .venv
find . -type f -name '*.pyc' -delete
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'