-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
106 lines (96 loc) · 3.88 KB
/
Makefile
File metadata and controls
106 lines (96 loc) · 3.88 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
SHELL := bash
.PHONY: docs
MINIMUM_PYTHON_VERSION := 3.9
# Create all environments
install:
{ hatch --version || pipx install --upgrade hatch || python3 -m pip install --upgrade hatch ; } && \
hatch env create default && \
hatch env create docs && \
hatch env create hatch-static-analysis && \
hatch env create hatch-test && \
echo "Installation complete"
# Re-create all environments, from scratch (no reference to pinned
# requirements)
reinstall:
{ hatch --version || pipx install --upgrade hatch || python3 -m pip install --upgrade hatch ; } && \
hatch env prune && \
make && \
make requirements
distribute:
hatch build && hatch publish && rm -rf dist
# This will upgrade all requirements, and refresh pinned requirements to
# match
upgrade:
hatch run dependence freeze\
--include-pointer /tool/hatch/envs/default\
--include-pointer /project\
-nv '*'\
pyproject.toml > .requirements.txt && \
hatch run pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run docs:dependence freeze\
--include-pointer /tool/hatch/envs/docs\
--include-pointer /project\
-nv '*'\
pyproject.toml > .requirements.txt && \
hatch run docs:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-static-analysis:dependence freeze\
--include-pointer /tool/hatch/envs/docs\
--include-pointer /project\
-nv '*'\
pyproject.toml > .requirements.txt && \
hatch run hatch-static-analysis:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-test.py$(MINIMUM_PYTHON_VERSION):dependence freeze\
--include-pointer /tool/hatch/envs/hatch-test\
--include-pointer /project\
-nv '*'\
pyproject.toml > .requirements.txt && \
hatch run hatch-test.py$(MINIMUM_PYTHON_VERSION):pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-test.py3.10:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-test.py3.11:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-test.py3.12:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
hatch run hatch-test.py3.13:pip install --upgrade --upgrade-strategy eager\
-r .requirements.txt && \
rm .requirements.txt && \
make requirements
# This will update requirement specifiers to align with the
# package versions installed in each environment, and will align the project
# dependency versions with those installed in the default environment
requirements:
hatch run dependence update\
--include-pointer /tool/hatch/envs/default\
--include-pointer /project\
pyproject.toml && \
hatch run docs:dependence update pyproject.toml --include-pointer /tool/hatch/envs/docs && \
hatch run hatch-test.py$(MINIMUM_PYTHON_VERSION):dependence update pyproject.toml --include-pointer /tool/hatch/envs/hatch-test && \
hatch run hatch-static-analysis:dependence update pyproject.toml --include-pointer /tool/hatch/envs/hatch-static-analysis && \
echo "Requirements Updated"
# Test & check linting/formatting (for local use only)
test:
{ hatch --version || pipx install --upgrade hatch || python3 -m pip install --upgrade hatch ; } && \
hatch fmt --check && hatch run mypy && hatch test -c -vv && \
echo "Tests Successful"
# Apply formatting rules and perform static analysis and type checking
format:
hatch fmt --formatter
hatch fmt --linter
hatch run mypy && \
echo "Formatting Successful"
# Build the documentation and serve it locally
docs:
hatch run docs:mkdocs build && \
hatch run docs:mkdocs serve
# Cleanup untracked files
clean:
git clean -f -e .vscode -e .idea -e .env -e .data.json -x .
# Download an updated Open API document and re-generate the client and model
remodel:
{ hatch --version || pipx install --upgrade hatch || python3 -m pip install --upgrade hatch ; } && \
hatch run python scripts/remodel.py && \
echo "Remodel Complete"