| 1 |
.DEFAULT_GOAL := help |
| 2 |
.PHONY: build coverage deps format help lint test docs |
| 3 |
|
| 4 |
build: ## Build the wheel and the source distribution |
| 5 |
rm -rf dist |
| 6 |
uv build |
| 7 |
|
| 8 |
coverage: ## Run tests with coverage |
| 9 |
uv run coverage erase |
| 10 |
uv run coverage run --include=osmapi/* -m pytest -ra |
| 11 |
uv run coverage report -m |
| 12 |
|
| 13 |
deps: ## Install dependencies |
| 14 |
uv sync |
| 15 |
uv run pre-commit install |
| 16 |
|
| 17 |
docs: ## Generate documentation |
| 18 |
uv run pdoc -o docs osmapi |
| 19 |
|
| 20 |
format: ## Format source code (black codestyle) |
| 21 |
uv run black osmapi examples tests |
| 22 |
|
| 23 |
lint: ## Linting of source code |
| 24 |
uv run black --check --diff osmapi examples tests |
| 25 |
uv run flake8 --statistics --show-source . |
| 26 |
uv run mypy osmapi |
| 27 |
|
| 28 |
test: ## Run tests (run in UTF-8 mode in Windows) |
| 29 |
uv run python -Xutf8 -m pytest --cov=osmapi tests/ |
| 30 |
|
| 31 |
help: SHELL := /bin/bash |
| 32 |
help: ## Show help message |
| 33 |
@IFS=$$'\n' ; \ |
| 34 |
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ |
| 35 |
printf "%s\n\n" "Usage: make [task]"; \ |
| 36 |
printf "%-20s %s\n" "task" "help" ; \ |
| 37 |
printf "%-20s %s\n" "------" "----" ; \ |
| 38 |
for help_line in $${help_lines[@]}; do \ |
| 39 |
IFS=$$':' ; \ |
| 40 |
help_split=($$help_line) ; \ |
| 41 |
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ |
| 42 |
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ |
| 43 |
printf '\033[36m'; \ |
| 44 |
printf "%-20s %s" $$help_command ; \ |
| 45 |
printf '\033[0m'; \ |
| 46 |
printf "%s\n" $$help_info; \ |
| 47 |
done |