-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (59 loc) · 1.82 KB
/
Makefile
File metadata and controls
69 lines (59 loc) · 1.82 KB
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
62
63
64
65
66
67
68
69
.PHONY: help
help: ## Show the help.
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@fgrep "##" Makefile | fgrep -v fgrep
.PHONY: show
show: ## Show the current environment.
@echo "Current environment:"
@uv run python -V
@uv run python -m site
.PHONY: install
install: ## Install the project in dev mode.
uv sync
.PHONY: install-hooks
install-hooks: ## Install git pre-commit hooks.
cp scripts/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
@echo "Pre-commit hook installed."
.PHONY: fmt
fmt: ## Format code using ruff.
uv run ruff format pcons/ tests/ examples/
uv run ruff check --fix pcons/ tests/ examples/
.PHONY: lint
lint: ## Run ruff and ty linters.
uv run ruff check pcons/ tests/ examples/
uv run ruff format --check pcons/ tests/ examples/
uvx ty check pcons/ examples/
.PHONY: test
test: ## Run tests.
uv run pytest
.PHONY: test-cov
test-cov: ## Run tests with coverage report.
uv run pytest --cov=pcons --cov-report=html --cov-report=xml
@echo "Coverage report: htmlcov/index.html"
.PHONY: watch
watch: ## Run tests on every change.
ls pcons/**/*.py tests/**/*.py | entr uv run pytest -x
.PHONY: clean
clean: ## Clean unused files.
@find ./ -name '*.pyc' -exec rm -f {} \;
@find ./ -name '__pycache__' -exec rm -rf {} \;
@find ./ -name 'Thumbs.db' -exec rm -f {} \;
@find ./ -name '*~' -exec rm -f {} \;
@rm -rf .cache
@rm -rf .pytest_cache
@rm -rf .mypy_cache
@rm -rf .ruff_cache
@rm -rf build
@rm -rf dist
@rm -rf *.egg-info
@rm -rf htmlcov
@rm -rf .tox/
@rm -rf docs/_build
.PHONY: docs
docs: ## Build the documentation.
@echo "building documentation ..."
cd docs && uv run python pcons-build.py
@open docs/build/index.html || xdg-open docs/build/index.html