|
1 | | -check-linting: |
2 | | - uv run ruff check typeid/ tests/ |
3 | | - uv run black --check --diff typeid/ tests/ --line-length 119 |
4 | | - uv run mypy typeid/ --pretty |
| 1 | +# ============================================================================== |
| 2 | +# Project configuration |
| 3 | +# ============================================================================== |
5 | 4 |
|
| 5 | +PACKAGE := typeid |
| 6 | +TESTS := tests |
| 7 | +DIST_DIR := dist |
| 8 | +VENV_DIR := .venv |
6 | 9 |
|
7 | | -fix-linting: |
8 | | - uv run ruff check --fix typeid/ tests/ |
9 | | - uv run black typeid/ tests/ --line-length 119 |
| 10 | +UV := uv run |
| 11 | +PYTEST := $(UV) pytest |
| 12 | +RUFF := $(UV) ruff |
| 13 | +BLACK := $(UV) black |
| 14 | +MYPY := $(UV) mypy |
10 | 15 |
|
| 16 | +# ============================================================================== |
| 17 | +# Phony targets |
| 18 | +# ============================================================================== |
11 | 19 |
|
12 | | -.PHONY: build-sdist |
13 | | -build-sdist: |
14 | | - @rm -rf dist build *.egg-info .venv |
15 | | - @uv build --sdist -o dist |
16 | | - @ls -la dist |
| 20 | +.PHONY: help lint lint-fix test test-docs docs docs-build build-sdist clean |
17 | 21 |
|
| 22 | +# ============================================================================== |
| 23 | +# Help |
| 24 | +# ============================================================================== |
18 | 25 |
|
19 | | -test: |
20 | | - uv run pytest -v |
| 26 | +help: |
| 27 | + @echo "Available targets:" |
| 28 | + @echo "" |
| 29 | + @echo " lint Run all linters (ruff, black, mypy)" |
| 30 | + @echo " lint-fix Automatically fix linting issues" |
| 31 | + @echo " test Run test suite" |
| 32 | + @echo " test-docs Run documentation tests" |
| 33 | + @echo " docs Serve documentation locally" |
| 34 | + @echo " docs-build Build documentation" |
| 35 | + @echo " build-sdist Build source distribution" |
| 36 | + @echo " clean Remove build artifacts" |
| 37 | + @echo "" |
| 38 | + |
| 39 | +# ============================================================================== |
| 40 | +# Linting |
| 41 | +# ============================================================================== |
| 42 | + |
| 43 | +lint: |
| 44 | + $(RUFF) check $(PACKAGE)/ $(TESTS)/ |
| 45 | + $(BLACK) --check --diff $(PACKAGE)/ $(TESTS)/ |
| 46 | + $(MYPY) $(PACKAGE)/ |
| 47 | + |
| 48 | +lint-fix: |
| 49 | + $(RUFF) check --fix $(PACKAGE)/ $(TESTS)/ |
| 50 | + $(BLACK) $(PACKAGE)/ $(TESTS)/ |
| 51 | + |
| 52 | +# ============================================================================== |
| 53 | +# Testing |
| 54 | +# ============================================================================== |
21 | 55 |
|
| 56 | +test: |
| 57 | + $(PYTEST) -v $(TESTS) |
22 | 58 |
|
23 | 59 | test-docs: |
24 | | - uv run pytest README.md docs/ --markdown-docs |
| 60 | + $(PYTEST) README.md docs/ --markdown-docs |
25 | 61 |
|
| 62 | +# ============================================================================== |
| 63 | +# Documentation |
| 64 | +# ============================================================================== |
26 | 65 |
|
27 | 66 | docs: |
28 | 67 | mkdocs serve |
29 | 68 |
|
30 | | - |
31 | | -docs-build: |
| 69 | +docs-build: |
32 | 70 | mkdocs build |
| 71 | + |
| 72 | +# ============================================================================== |
| 73 | +# Build & cleanup |
| 74 | +# ============================================================================== |
| 75 | + |
| 76 | +build-sdist: clean |
| 77 | + @uv build --sdist -o $(DIST_DIR) |
| 78 | + @ls -la $(DIST_DIR) |
| 79 | + |
| 80 | +clean: |
| 81 | + @rm -rf $(DIST_DIR) build *.egg-info $(VENV_DIR) |
0 commit comments