|
1 |
| -.PHONY: help lint test build docs-serve install-dev publish clean |
| 1 | +.DEFAULT_GOAL := help |
2 | 2 |
|
3 |
| -help: |
4 |
| - @echo "Available commands:" |
5 |
| - @echo "make lint - Check code with linters using pre-commit." |
6 |
| - @echo "make test - Run unit tests using pytest." |
7 |
| - @echo "make build - Build the package for PyPI." |
8 |
| - @echo "make docs-serve - Serve documentation using mkdocs." |
9 |
| - @echo "make install-dev - Install development dependencies." |
10 |
| - @echo "make publish - Publish to PyPI." |
11 |
| - |
12 |
| -install-dev: |
| 3 | +.PHONY: install-dev |
| 4 | +install-dev: ## Install development dependencies. |
13 | 5 | @echo "Installing development dependencies..."
|
14 | 6 | @python -m pip install ".[dev]"
|
15 |
| - @python -m pre-commit install |
| 7 | + @pre-commit install |
16 | 8 |
|
17 |
| -lint: |
| 9 | +.PHONY: lint |
| 10 | +lint: ## Check code with linters using pre-commit. |
18 | 11 | @echo "Running linters..."
|
19 | 12 | @pre-commit run --all-files
|
20 | 13 |
|
21 |
| -test: |
| 14 | +.PHONY: test |
| 15 | +test: ## Run unit tests using pytest. |
22 | 16 | @echo "Running tests..."
|
23 | 17 | @pytest --exitfirst --verbose --failed-first --cov=.
|
24 | 18 |
|
25 |
| -build: |
| 19 | +.PHONY: build |
| 20 | +build: ## Build the package for PyPI. |
26 | 21 | @echo "Building for PyPI..."
|
27 | 22 | @python -m pip install --upgrade build
|
28 | 23 | @python -m build
|
29 | 24 |
|
30 |
| -publish: |
| 25 | +.PHONY: publish |
| 26 | +publish: ## Publish to PyPI. |
31 | 27 | @echo "Publishing to PyPI..."
|
32 | 28 | @python -m pip install --upgrade twine
|
33 | 29 | @python -m twine upload --repository llm-guard dist/*
|
34 | 30 |
|
35 |
| -docs-serve: |
| 31 | +.PHONY: docs-serve |
| 32 | +docs-serve: ## Serve documentation using mkdocs. |
36 | 33 | @echo "Serving documentation..."
|
37 | 34 | @mkdocs serve -a localhost:8085
|
38 | 35 |
|
39 |
| -clean: |
| 36 | +.PHONY: clean |
| 37 | +clean: ## Clean and Remove build files and pytest cache. |
40 | 38 | @echo "Cleaning up..."
|
41 | 39 | @rm -rf build dist .pytest_cache .egg-info llm_guard.egg-info
|
| 40 | + |
| 41 | +.PHONY: help |
| 42 | +help: ## List all targets and help information. |
| 43 | + @echo "Available commands:" |
| 44 | + @grep --no-filename -E '^([a-z.A-Z_%-/]+:.*?)##' $(MAKEFILE_LIST) | sort | \ |
| 45 | + awk 'BEGIN {FS = ":.*?(## ?)"}; { \ |
| 46 | + if (length($$1) > 0) { \ |
| 47 | + printf " \033[36m%-30s\033[0m %s\n", $$1, $$2; \ |
| 48 | + } else { \ |
| 49 | + printf "%s\n", $$2; \ |
| 50 | + } \ |
| 51 | + }' |
0 commit comments