-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (52 loc) · 2.17 KB
/
Makefile
File metadata and controls
73 lines (52 loc) · 2.17 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
62
63
64
65
66
67
68
69
70
71
72
73
SHELL=/bin/bash
DATETIME:=$(shell date -u +%Y%m%dT%H%M%SZ)
help: # Preview Makefile commands
@awk 'BEGIN { FS = ":.*#"; print "Usage: make <target>\n\nTargets:" } \
/^[-_[:alpha:]]+:.?*#/ { printf " %-15s%s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# ensure OS binaries aren't called if naming conflict with Make recipes
.PHONY: help venv install update test coveralls lint black mypy ruff safety lint-apply black-apply ruff-apply
##############################################
# Python Environment and Dependency commands
##############################################
install: .venv .git/hooks/pre-commit # Install Python dependencies and create virtual environment if not exists
uv sync --dev
.venv: # Creates virtual environment if not found
@echo "Creating virtual environment at .venv..."
uv venv .venv
.git/hooks/pre-commit: # Sets up pre-commit hook if not setup
@echo "Installing pre-commit hooks..."
uv run pre-commit install
venv: .venv # Create the Python virtual environment
update: # Update Python dependencies
uv lock --upgrade
uv sync --dev
######################
# Unit test commands
######################
test: # Run tests and print a coverage report
uv run coverage run --source=my_app -m pytest -vv
uv run coverage report -m
coveralls: test # Write coverage data to an LCOV report
uv run coverage lcov -o ./coverage/lcov.info
####################################
# Code quality and safety commands
####################################
lint: black mypy ruff safety # Run linters
black: # Run 'black' linter and print a preview of suggested changes
uv run black --check --diff .
mypy: # Run 'mypy' linter
uv run mypy .
ruff: # Run 'ruff' linter and print a preview of errors
uv run ruff check .
safety: # Check for security vulnerabilities
uv run pip-audit
lint-apply: black-apply ruff-apply # Apply changes with 'black' and resolve 'fixable errors' with 'ruff'
black-apply: # Apply changes with 'black'
uv run black .
ruff-apply: # Resolve 'fixable errors' with 'ruff'
uv run ruff check --fix .
##############################
# CLI convenience commands
##############################
my-app: # CLI without any arguments, utilizing uv script entrypoint
uv run my-app