-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.18 KB
/
Copy pathMakefile
File metadata and controls
79 lines (63 loc) · 2.18 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
74
75
76
77
78
79
SHELL := /bin/bash
all: help
.PHONY: help
help: ## List all commands
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9 -_]+:.*?## / {printf "\033[36m%-26s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: install-base-req
install-base-req: ## Install needed base packages via apt
sudo apt install python3-pip python3-venv
.PHONY: install
install: ## Install the project in a Python virtualenv
python3 -m venv .venv
.venv/bin/pip install -U pip
.venv/bin/pip install -U uv
.venv/bin/uv sync
.PHONY: update-requirements
update-requirements: ## Update requirements
python3 -m venv .venv
.venv/bin/pip install -U pip
.venv/bin/pip install -U uv
.venv/bin/uv lock --upgrade
.venv/bin/uv audit
.venv/bin/uv sync
.PHONY: lint
lint: ## Check/fix code style by running: "ruff check"
.venv/bin/ruff check
.PHONY: lint-fix
lint-fix: ## Check/fix code style by running: "ruff check --fix"
.venv/bin/ruff check --fix
.PHONY: coverage-report
coverage-report: ## Creates coverage report
.venv/bin/coverage combine --append
.venv/bin/coverage report
.venv/bin/coverage xml
.venv/bin/coverage json
.PHONY: coverage
coverage: ## Run tests with coverage (prefer the "nox" target)
.venv/bin/coverage run
$(MAKE) coverage-report
.PHONY: nox
nox: ## Run tests via nox with all environments and create coverage report
uv run nox
$(MAKE) coverage-report
.PHONY: test
test: ## Run tests
.venv/bin/python3 -m unittest --verbose --locals
.PHONY: update-test-snapshot-files
update-test-snapshot-files: ## Update all snapshot files (by remove and recreate all snapshot files)
find . -type f -name '*.snapshot.*' -delete
RAISE_SNAPSHOT_ERRORS=0 .venv/bin/python3 -m unittest
.PHONY: mypy
mypy: ## Run mypy
.venv/bin/mypy .
.PHONY: pip-audit
pip-audit: ## Run https://github.com/pypa/pip-audit
.venv/bin/uv export --no-header --frozen --no-editable --no-emit-project -o /tmp/temp_requirements.txt
.venv/bin/pip-audit --strict --require-hashes --disable-pip -r /tmp/temp_requirements.txt
.PHONY: publish
publish: ## Release new version to PyPi
.venv/bin/pip install -e .
.venv/bin/python3 bx_py_utils_tests/publish.py
.PHONY: clean
clean: ## Remove created files from the test project
git clean -dfX bx_py_utils_tests/