-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathMakefile
59 lines (40 loc) · 1.73 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
# Author: Alex B
# Description: Makefile for setting up the development environment. Includes convenient aliases for common tasks.
PY_VERSION := $(shell cat .python-version)
.PHONY: uv venv pre-commit dev all test lint format scan scan-new-baseline \
scan-without-baseline clean
check: format lint test
.uv-installed-$(PY_VERSION): .python-version
@if [ ! -f .python-version ]; then echo 'Please create a .python-version file with the desired Python version'; exit 1; fi
@if command -v uv > /dev/null; then echo 'Verified uv is installed'; else echo 'Please install uv by running `curl -LsSf https://astral.sh/uv/install.sh | sh` or visit https://docs.astral.sh/uv/ for more information'; exit 1; fi
@uv tool update-shell
@uv python install
@rm -f .uv-installed-*
@touch .uv-installed-$(PY_VERSION)
uv: .uv-installed-$(PY_VERSION)
.venv: .uv-installed-$(PY_VERSION)
@uv venv .venv
venv: .venv
.git/hooks/pre-commit: .uv-installed-$(PY_VERSION)
@uv tool install pre-commit
@uv tool run pre-commit install
pre-commit: .git/hooks/pre-commit
dev: .venv .git/hooks/pre-commit
@uv sync --extra=dev --extra=duckdb
clean:
@rm -rf .venv target demo_duckdb/target demo_sqlite/target
lint: .uv-installed-$(PY_VERSION)
@uvx ruff check
format: .uv-installed-$(PY_VERSION)
@uvx ruff check --fix --select I
@uvx ruff format --preview
test: .uv-installed-$(PY_VERSION)
@uv run pytest tests/
scan: .uv-installed-$(PY_VERSION)
@uvx bandit -r src -b tests/bandit_baseline.json
scan-new-baseline: .uv-installed-$(PY_VERSION)
@uvx bandit -r src -f json -o tests/bandit_baseline.json
scan-without-baseline: .uv-installed-$(PY_VERSION)
@uvx bandit -r src
requirements.txt: .uv-installed-$(PY_VERSION)
@uv export -o requirements.txt --no-hashes --frozen