|
| 1 | +.DEFAULT_GOAL := help |
| 2 | + |
| 3 | +###### Development commands |
| 4 | + |
| 5 | +compile-requirements: ## Compile requirements files |
| 6 | + pip-compile requirements/base.in |
| 7 | + pip-compile requirements/dev.in |
| 8 | + |
| 9 | +upgrade-requirements: ## Upgrade requirements files |
| 10 | + pip-compile --upgrade requirements/base.in |
| 11 | + pip-compile --upgrade requirements/dev.in |
| 12 | + |
| 13 | +test: test-lint test-unit test-types test-format ## Run all tests |
| 14 | + |
| 15 | +test-lint: ## Run linting tests |
| 16 | + pylint --errors-only --enable=unused-import,unused-argument lecture tests |
| 17 | + |
| 18 | +test-unit: ## Run unit tests |
| 19 | + python -m unittest discover tests |
| 20 | + |
| 21 | +test-types: ## Check types with mypy |
| 22 | + mypy --ignore-missing-imports --strict lecture tests |
| 23 | + |
| 24 | +test-format: ## Check code formatting |
| 25 | + black --check lecture tests |
| 26 | + |
| 27 | +format: ## Auto-format code with black |
| 28 | + black lecture tests |
| 29 | + |
| 30 | +isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. |
| 31 | + isort --skip=templates lecture tests |
| 32 | + |
| 33 | +examples: example-html example-olx ## Generate examples from the markdown file |
| 34 | +.PHONY: examples |
| 35 | + |
| 36 | +example-html: ## Generate HTML example from the markdown file |
| 37 | + lecture -v examples/course.md examples/course.html |
| 38 | + |
| 39 | +example-olx: ## Generate OLX example from the markdown file |
| 40 | + rm -rf examples/olx/* |
| 41 | + lecture -v examples/course.md examples/olx/ |
| 42 | + tar -czf examples/olx.tar.gz examples/olx |
| 43 | + |
| 44 | +###### Additional commands |
| 45 | + |
| 46 | +ESCAPE = |
| 47 | +help: ## Print this help |
| 48 | + @grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \ |
| 49 | + | sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \ |
| 50 | + | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' |
0 commit comments