-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (45 loc) · 1.52 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
.ONESHELL:
CMD:=poetry run
PYMODULE:=datawagon
ENTRYPOINT:=main.py
TESTS:=tests
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
pre-commit: check type isort format lint test requirements ## Run pre-commit checks
check:
@echo "Checking poetry..."
poetry check
type: ## Type check code
@echo "Type checking with mypy..."
$(CMD) mypy --namespace-packages --explicit-package-bases $(PYMODULE) $(TESTS)
isort: ## Sort imports
@echo "Sorting imports with isort..."
$(CMD) isort --quiet --recursive $(PYMODULE) $(TESTS)
format: ## Format code
@echo "Formatting code with black..."
$(CMD) black $(PYMODULE) $(TESTS)
lint: ## Lint code
@echo "Linting code with flake8..."
$(CMD) flake8 $(PYMODULE) $(TESTS)
test: ## Run tests
@echo "Running tests with pytest..."
$(CMD) pytest $(TESTS) --quiet
requirements: ## Generate requirements.txt
@echo "Generating requirements.txt..."
poetry export --without-hashes -f requirements.txt -o requirements.txt
# Stand alone, not used for automation
run: ## Run app
@echo "Running application..."
$(CMD) python $(PYMODULE)/$(ENTRYPOINT)
build-app: ## Build app
@echo "Building application with poetry..."
poetry build
install-app: ## Install app
@echo "Installing dependencies with poetry..."
poetry install
test-cov: ## Run tests with coverage
@echo "Running tests with pytest and coverage..."
$(CMD) pytest --cov=$(PYMODULE) $(TESTS) --cov-report html
clean-env:
@echo "Cleaning up virtual environment..."
rm -rf .venv