-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathMakefile
77 lines (66 loc) · 2.05 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
.PHONY: help check clean build coverage lint docs pre-commit setup test tox
# Help target to display available commands
help:
@echo "Usage: make <target>"
@echo ""
@echo "Available targets:"
@echo " check Run pre-commit, docs, tests, and build"
@echo " clean Clean up generated files and caches"
@echo " build Build package distribution"
@echo " coverage Identify code not covered with tests"
@echo " lint Run lint checks on the module"
@echo " docs Build documentation"
@echo " pre-commit Run pre-commit against all files"
@echo " setup Set up the development environment"
@echo " test Run tests (in parallel)"
@echo " tox Run tox (in parallel)"
@echo " help Show this summary of available commands"
# Run all checks
check:
$(MAKE) pre-commit
$(MAKE) docs
$(MAKE) test
$(MAKE) build
# Clean up generated files and caches
clean:
find . -name "*.mo" -delete
find . -name "*.pyc" -delete
rm -rf .mypy_cache/ .pytest_cache/ .ruff_cache/ dist/ tox/
rm -rf docs/build/ docs/source/_autosummary/
rm -f .coverage .coverage.xml
# Build package distribution
build:
rm -rf *.egg-info/
python3 -m build
# Run coverage analysis
coverage:
pytest --cov=brazilcep --cov-config=pyproject.toml --cov-report=term-missing --no-cov-on-fail --cov-report=html --junitxml=junit.xml -o junit_family=legacy
# Run lint checks
lint:
isort --check brazilcep tests
black --check brazilcep tests
ruff check brazilcep tests
mypy brazilcep
# Build documentation
docs:
rm -rf docs/build/
sphinx-autobuild -b html --watch brazilcep/ docs/source/ docs/build/
# Run pre-commit hooks
pre-commit:
pre-commit run --all-files
# Set up the development environment
setup:
pip install -e ".[dev]"
pip install -e ".[coverage]"
pip install -e ".[docs]"
pip install -e ".[build]"
pre-commit install --hook-type pre-commit
pre-commit install --hook-type pre-push
pre-commit autoupdate
mypy --install-types
# Run tests
test:
pytest -v
# Run tox
tox:
tox --parallel auto