-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (98 loc) · 4.58 KB
/
Makefile
File metadata and controls
128 lines (98 loc) · 4.58 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
VENV := .venv
INSTALL_SENTINEL := $(VENV)/.install.success
PYTHON := $(VENV)/bin/python
CI ?=
RUN := uv run
### Help ###
.PHONY: help
help::
@echo "╭─────────────────────────────────────────────────────────────╮"
@echo "│ Makefile for dm-bip │"
@echo "│ ──────────────────────── │"
@echo "│ Usage: │"
@echo "│ make <target> │"
@echo "│ │"
@echo "│ Pipeline targets: │"
@echo "│ pipeline Run the pipeline for a set of files |"
@echo "| pipeline-debug Print pipeline configuration |"
@echo "│ │"
@echo "│ Schema targets: │"
@echo "│ schema-create Create a schema from a set of files │"
@echo "│ schema-lint Lint a schema from a set of files │"
@echo "│ schema-clean Remove all generated schema files │"
@echo "│ │"
@echo "│ Validation targets: │"
@echo "│ validate-schema Validate generated schema │"
@echo "│ validate-data Validate data to generated schema │"
@echo "│ validate-clean Remove validation reports │"
@echo "│ │"
@echo "│ Project targets: │"
@echo "│ help Print this help message │"
@echo "│ all Install everything │"
@echo "│ fresh Clean and install everything │"
@echo "│ clean Clean up build artifacts │"
@echo "│ clobber Clean up generated files │"
@echo "│ │"
@echo "│ install Set up the virtual environment |"
@echo "│ git-hooks-install Install git pre-commit hooks |"
@echo "│ docs Generate documentation │"
@echo "│ test Run tests │"
@echo "│ │"
@echo "│ lint Lint all code │"
@echo "│ format Format all code │"
@echo "│ coverage Measure and report test coverage │"
@echo "│ │"
@echo "│ jupyter-notebook Start a Jupyter server and notebook │"
@echo "╰─────────────────────────────────────────────────────────────╯"
@echo
### Installation and Setup ###
.PHONY: all
all: install
.PHONY: fresh
fresh: clean clobber all
$(INSTALL_SENTINEL): uv.lock
uv sync --frozen --group docs $(if $(CI),--no-progress,)
touch $@
$(PYTHON): $(INSTALL_SENTINEL)
.PHONY: install
install: $(INSTALL_SENTINEL)
git-hooks-install: .git/hooks/pre-commit
.git/hooks/pre-commit: scripts/git-hooks/pre-commit
cp $< $@
chmod +x $@
### Documentation ###
.PHONY: docs
docs: $(INSTALL_SENTINEL)
$(RUN) sphinx-apidoc -o docs src/dm_bip/ --ext-autodoc -f
$(RUN) sphinx-build -b html docs docs/_build
### Testing ###
.PHONY: test
test: $(PYTHON)
$(RUN) pytest tests
### Linting, Formatting, and Cleaning ###
.PHONY: clean
clean:
rm -f `find . -type f -name '*.py[co]'`
rm -rf `find . -name __pycache__`
rm -rf .ruff_cache
rm -rf .pytest_cache
rm -rf docs/_build
rm -rf $(VENV)
.PHONY: clobber
clobber:
.PHONY: lint
lint: $(PYTHON)
$(RUN) ruff check $(if $(CI),--output-format=github,)
$(RUN) ruff format --check
$(MAKE) lint-notebooks
.PHONY: format
format: $(PYTHON)
-$(RUN) ruff check --fix
-$(RUN) ruff format
.PHONY: coverage
coverage: $(PYTHON)
$(RUN) pytest --cov=dm_bip --cov-report=term-missing --cov-report=xml tests
include pipeline.Makefile
include notebook.Makefile