-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (49 loc) · 1.93 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
FULL_SOURCES = object_mother_pattern tests
SOURCES = object_mother_pattern
CONFIGURATION_FILE = pyproject.toml
.PHONY: help
help: # Display this help
@echo "Usage: make [COMMAND] [OPTIONS]..."
@awk 'BEGIN {FS = ":.*#"; printf "\nCommands:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?#/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: install
install: # Install dependencies
@make install-dev
.PHONY: install-dev
install-dev: # Install development dependencies
@pip install --requirement requirements_dev.txt
.PHONY: install-prod
install-prod: # Install production dependencies
@pip install --requirement requirements.txt
.PHONY: format
format: # Automatically format python code
@ruff check $(FULL_SOURCES) --fix-only --config $(CONFIGURATION_FILE)
@ruff format $(FULL_SOURCES) --config $(CONFIGURATION_FILE)
.PHONY: lint
lint: # Lint python code
@set -e; \
mypy $(FULL_SOURCES) --txt-report . --config-file $(CONFIGURATION_FILE) || mypy_exit=$$?; \
ruff check $(FULL_SOURCES) || ruff_exit=$$?; \
exit $$(( mypy_exit || ruff_exit ))
.PHONY: test
test: # Run all tests
@pytest --config-file $(CONFIGURATION_FILE)
.PHONY: coverage
coverage: # Get coverage report
@set -e; \
coverage erase; \
coverage run --module pytest --config-file $(CONFIGURATION_FILE) || coverage_exit=$$?; \
coverage combine; \
coverage report; \
exit $$coverage_exit
.PHONY: clean
clean: # Remove all generated files
@rm --force --recursive `find . -type f -name '*.py[co]'`
@rm --force --recursive `find . -name __pycache__`
@rm --force --recursive `find . -name .ruff_cache`
@rm --force --recursive `find . -name .mypy_cache`
@rm --force --recursive `find . -name index.txt`
@rm --force --recursive `find . -name .pytest_cache`
@rm --force --recursive .coverage
@rm --force --recursive .coverage.*
@rm --force --recursive coverage.xml
@rm --force --recursive htmlcov