-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
121 lines (102 loc) · 2.92 KB
/
Makefile
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
.DEFAULT_GOAL := help
.REPORTS_DIR := coverage
.PACKAGE_NAME := waldiez_jupyter
.PACKAGE_MANAGER := yarn
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Default target: help"
@echo ""
@echo "Targets:"
@echo " help Show this message and exit"
@echo " init Initialize the development environment"
@echo " format Format the code"
@echo " lint Lint the code"
@echo " forlint Alias for 'make format && make lint'"
@echo " dev Start dev mode"
@echo " dev-react Start dev mode for React"
@echo " dev-stop Stop dev mode"
@echo " build Build the projects"
@echo " build-py Build the Python package"
@echo " build-js Build the JavaScript package"
@echo " all Run 'requirements', 'forlint', 'test', 'build'"
@echo " image Build a container image"
@echo " test Run the tests"
@echo " requirements Generate requirements/*.txt"
@echo " clean Remove unneeded files (__pycache__, .mypy_cache, etc.)"
@echo ""
.PHONY: format
format:
isort .
autoflake --remove-all-unused-imports --remove-unused-variables --in-place .
black --config pyproject.toml .
ruff format --config pyproject.toml .
${.PACKAGE_MANAGER} run lint
.PHONY: init
init:
python scripts/init.py
.PHONY: lint
lint:
isort --check-only .
black --check --config pyproject.toml .
mypy --config pyproject.toml .
flake8 --config=.flake8
pydocstyle --config pyproject.toml .
bandit -r -c pyproject.toml .
yamllint -c .yamllint.yaml .
ruff check --config pyproject.toml .
pylint --rcfile=pyproject.toml --recursive y --output-format=text .
${.PACKAGE_MANAGER} run lint
.PHONY: forlint
forlint: format lint
.PHONY: clean
clean:
python scripts/clean.py
${.PACKAGE_MANAGER} run clean:all
.PHONY: requirements
requirements:
python scripts/requirements.py
.PHONY: test
test:
python -c 'import os; os.makedirs("coverage", exist_ok=True);'
pytest \
-c pyproject.toml \
--capture=sys \
--cov=${.PACKAGE_NAME} \
--cov-branch \
--cov-report=term-missing:skip-covered \
--cov-report html:${.REPORTS_DIR}/html \
--cov-report xml:${.REPORTS_DIR}/coverage.xml \
--cov-report lcov:${.REPORTS_DIR}/lcov.info \
--junitxml=${.REPORTS_DIR}/xunit.xml \
${.PACKAGE_NAME}/tests
.PHONY: .pre-dev
.pre-dev:
python -m pip install -e .
jupyter labextension develop --overwrite .
.PHONY: dev
dev: .pre-dev
python scripts/run.py
.PHONY: dev-react
dev-react:
python scripts/run.py --react
.PHONY: dev-stop
dev-stop:
python scripts/run.py --stop
.PHONY: build-py
build-py:
python -m pip install build
python -m build
.PHONY: build-js
build-js:
${.PACKAGE_MANAGER} install && ${.PACKAGE_MANAGER} run lint && ${.PACKAGE_MANAGER} run build
.PHONY: build
build: build-py build-js
.PHONY: all
all: requirements forlint test build
${.PACKAGE_MANAGER} run test
${.PACKAGE_MANAGER} run test:ui
.PHONY: image
image:
python scripts/image.py