-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (44 loc) · 1.38 KB
/
Makefile
File metadata and controls
55 lines (44 loc) · 1.38 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
.DEFAULT_GOAL := help
# Explicit targets to avoid conflict with files of the same name.
.PHONY: \
requirements \
lint check format \
build test \
help
PYTHONPATH=
SHELL=/usr/bin/env bash
VENV=.venv
ifeq ($(OS),Windows_NT)
VENV_BIN=$(VENV)/Scripts
else
VENV_BIN=$(VENV)/bin
endif
.venv: ## Set up a Python virtual environment and install dev packages
uv venv $(VENV)
requirements: .venv ## Install/update Python dev packages
@unset CONDA_PREFIX \
&& uv pip install -e .[dev]
pytest: requirements
ifeq ($(OS),Windows_NT)
set PYTHONPATH=./build
else
export PYTHONPATH=./build
endif
$(VENV_BIN)/python -m pytest -vv ./test
lint: requirements ## Apply autoformatting and linting rules
$(VENV_BIN)/ruff check src_py test
$(VENV_BIN)/ruff format src_py test
-$(VENV_BIN)/mypy src_py test
check: requirements
$(VENV_BIN)/ruff check src_py test --verbose
format: requirements
$(VENV_BIN)/ruff format src_py test
build: ## Compile real_ladybug (and install in 'build') for Python
$(MAKE) -C ../../ python
cp src_py/*.py build/real_ladybug/
test: requirements ## Run the Python unit tests
cp src_py/*.py build/real_ladybug/ && cd build
$(VENV_BIN)/pytest test
help: ## Display this help information
@echo -e "\033[1mAvailable commands:\033[0m"
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort