-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (114 loc) · 5.6 KB
/
Copy pathMakefile
File metadata and controls
143 lines (114 loc) · 5.6 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
PYTHON ?= python3
DIST_DIR ?= dist
# Base URL of the published httk documentation site, used for cross-linking docs
# between httk repositories (read by docs/conf.py via HTTK_DOCS_BASE_URL).
DOCS_BASE_URL ?= https://docs.httk.org
.PHONY: docs docs-live docs-clean docs-inventories docs-lock docs-lock-check optimade-defs symmetry-data clean dist-clean dist dist-check release-check release-prepare format format-check typecheck typecheck_pyright lint test test_fastfail test-extended test-extended-fastfail benchmarks audit
docs: docs-clean
HTTK_DOCS_BASE_URL=$(DOCS_BASE_URL) $(PYTHON) -m sphinx -E -a -b html -W --keep-going docs docs/_build/html
docs-live:
HTTK_DOCS_BASE_URL=$(DOCS_BASE_URL) sphinx-autobuild docs docs/_build/html
docs-clean:
rm -rf docs/_build docs/reference/autoapi docs/examples
# Refresh the committed intersphinx inventories (the one docs task that uses the
# network); docs builds themselves resolve against these vendored files offline.
docs-inventories:
curl -fsSL https://docs.python.org/3/objects.inv -o docs/_inventories/python.inv
# Requires a current docs/requirements.lock; dependency release docs must be published.
$(PYTHON) -m httk.core.docs lock-check
$(PYTHON) -m httk.core.docs refresh-inventories --base-url $(DOCS_BASE_URL) --channel release .
# Regenerate the portable documentation lock (network target).
docs-lock:
$(PYTHON) -m httk.core.docs lock .
# Verify the lock in a clean environment and run the strict documentation build
# (network target; the lock installation and build are intentionally transparent).
docs-lock-check: docs-clean
@set -eu; \
check_dir=$$(mktemp -d "$${TMPDIR:-/tmp}/httk-atomistic-docs-lock-check.XXXXXX"); \
trap 'rm -rf "$$check_dir"' EXIT; \
env -u PYTHONPATH -u PYTHONHOME $(PYTHON) -m venv "$$check_dir/venv"; \
env -u PYTHONPATH -u PYTHONHOME "$$check_dir/venv/bin/python" -m pip install -r docs/requirements.lock; \
env -u PYTHONPATH -u PYTHONHOME "$$check_dir/venv/bin/python" -m pip check; \
env -u PYTHONPATH -u PYTHONHOME "$$check_dir/venv/bin/python" -m pip install . --no-deps --no-build-isolation; \
env -u HTTK_DOCS_VERSION -u PYTHONPATH -u PYTHONHOME HTTK_DOCS_BASE_URL="$(DOCS_BASE_URL)" \
"$$check_dir/venv/bin/python" -m sphinx -E -a -b html -W --keep-going docs "$$check_dir/html"
# Refresh the vendored OPTIMADE standard structures entry-type definition (the one
# source task that uses the network); the checked-in copy under
# src/httk/registry/schemas/atomistic/ is the authoritative supported version.
optimade-defs:
curl -fsSL https://schemas.optimade.org/defs/v1.3/entrytypes/optimade/structures.json -o src/httk/registry/schemas/atomistic/structures.json
curl -fsSL https://schemas.optimade.org/defs/v1.3/entrytypes/optimade/trajectories.json -o src/httk/registry/schemas/atomistic/trajectories.json
curl -fsSL https://raw.githubusercontent.com/Materials-Consortia/schemas/master/LICENSE -o src/httk/registry/schemas/atomistic/LICENSE
# Refresh the vendored httk property definitions from the published schemas.httk.org
# v0.1 set (network target, like optimade-defs); the checked-in copies under
# src/httk/registry/schemas/atomistic/ are the authoritative supported versions.
HTTK_DEFS = \
chemistry/species_charges \
chemistry/species_labels \
chemistry/species_spins \
chemistry/structure_charge \
core/fractional_coordinate_precision \
core/length_precision \
magnetism/site_moments \
pointgroups/crystal_system \
spacegroups/centring_type \
spacegroups/hall_entry \
spacegroups/is_reference_setting \
spacegroups/setting_it_nc \
symmetry/affine_transformation \
trajectories/frame_stresses \
trajectories/frame_temperatures \
trajectories/frame_total_energies \
trajectories/time_step
httk-defs:
set -e; for def in $(HTTK_DEFS); do \
curl -fsSL "https://schemas.httk.org/defs/v0.1/properties/$$def.json" \
-o "src/httk/registry/schemas/atomistic/$$(basename "$$def").json"; \
done
# Refresh the vendored CC BY 4.0 symmetry datasets under src/httk/atomistic/data/ from a
# local data-generators checkout. Offline, unlike optimade-defs. The five canonical
# appropriately-sized json.gz files are copied byte-for-byte; see README.md.
DATA_GENERATORS ?= ../data-generators-validation/data-generators
symmetry-data:
$(PYTHON) tools/vendor_symmetry_data.py $(DATA_GENERATORS)
clean: docs-clean dist-clean
find . -name "*.pyc" -print0 | xargs -0 rm -f
find . -name "*~" -print0 | xargs -0 rm -f
find . -name "__pycache__" -print0 | xargs -0 rm -rf
format:
$(PYTHON) -m ruff check src examples tools --fix
$(PYTHON) -m ruff format src examples tools
format-check: lint
$(PYTHON) -m ruff format --check src examples tools
lint:
$(PYTHON) -m ruff check src examples tools
pydoclint --quiet src
typecheck_pyright:
$(PYTHON) -m pyright
typecheck:
$(PYTHON) -m mypy
test:
$(PYTHON) -m pytest
test_fastfail:
$(PYTHON) -m pytest -q -x
test-extended:
HTTK_TEST_PROFILE=extended $(PYTHON) -m pytest -q -m ""
test-extended-fastfail:
HTTK_TEST_PROFILE=extended $(PYTHON) -m pytest -q -m "" -x
benchmarks:
$(PYTHON) benchmarks/bench_lift_p1.py
$(PYTHON) benchmarks/bench_vasp_trajectory_jsonl.py
check: format-check typecheck typecheck_pyright test
ci: format-check typecheck typecheck_pyright test-extended-fastfail
dist-clean:
rm -rf build $(DIST_DIR) src/httk_atomistic.egg-info
dist: dist-clean
$(PYTHON) -m build --outdir $(DIST_DIR)
dist-check: dist
$(PYTHON) -m twine check --strict $(DIST_DIR)/*
release-check: ci docs dist-check
$(PYTHON) -m httk.core.docs lock-check
@$(PYTHON) tools/check_release.py . --next-steps
release-prepare: export HTTK_RELEASE_VERSION := $(VERSION)
release-prepare:
@$(PYTHON) tools/check_release.py . --prepare