Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (109 loc) · 4.07 KB
/
Copy pathMakefile
File metadata and controls
150 lines (109 loc) · 4.07 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
144
145
146
147
148
149
150
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
.PHONY: sync sync-gpu sync-cutile lock lock-check lint typecheck format test test-cpu test-core test-xdr test-xfit test-ximage test-xfit-real test-xpois test-xscan test-xrep test-xray test-xbeam test-gpu test-cutile clean-dist build package-check wheels conda release-check ci-lint ci-test-cpu hooks
CPU_EXTRAS = --extra dev --extra torch --extra viz --extra photometry --extra xlens-inference --extra ximage --extra rubin --extra catalog
GPU_EXTRAS = --extra dev --extra gpu --extra viz
DRAGON_EXTRAS = --extra gpu --extra viz --extra dragon --extra catalog
DRAGON_PYTHON ?= 3.12
DRAGON_EXPORT = uv export --locked --no-default-groups --format requirements.txt --no-emit-project $(DRAGON_EXTRAS)
CORE_EXTRAS = --extra dev --extra photometry
VIZ_EXTRAS = --extra dev --extra viz --extra photometry
UV_RUN = uv run --locked
PYTEST = pytest
.PHONY: test-cpu-coverage test-xdr-coverage coverage-report sync-dragon requirements-dragon requirements-check
sync:
uv sync --locked $(CPU_EXTRAS)
sync-gpu:
uv sync --locked $(GPU_EXTRAS)
sync-cutile:
uv sync --locked $(GPU_EXTRAS) --extra cutile
sync-dragon:
uv sync --locked --python $(DRAGON_PYTHON) $(DRAGON_EXTRAS)
requirements-dragon:
$(DRAGON_EXPORT) > requirements-dragon.txt
requirements-check:
@export_file=$$(mktemp); trap 'rm -f "$$export_file"' EXIT; \
$(DRAGON_EXPORT) > "$$export_file" && \
diff -u requirements-dragon.txt "$$export_file"
lock:
uv lock
lock-check:
uv lock --check
lint: typecheck
$(UV_RUN) --extra dev ruff check .
$(UV_RUN) --extra dev ruff format --check .
typecheck:
$(UV_RUN) --extra dev mypy
format:
$(UV_RUN) --extra dev ruff check --fix .
$(UV_RUN) --extra dev ruff format .
test:
$(UV_RUN) $(CPU_EXTRAS) pytest
test-cpu:
CUDA_VISIBLE_DEVICES= CUPHOTON_XREP_TORCH_DEVICE=cpu $(UV_RUN) $(CPU_EXTRAS) $(PYTEST) -rs
test-cpu-coverage:
$(UV_RUN) --extra dev coverage erase
$(MAKE) test-cpu PYTEST="coverage run -m pytest"
$(MAKE) coverage-report
coverage-report:
$(UV_RUN) --extra dev coverage combine
$(UV_RUN) --extra dev coverage xml
$(UV_RUN) --extra dev coverage report
test-xdr-coverage:
$(UV_RUN) --extra dev --extra io bash scripts/coverage/xdr.sh
test-core:
$(UV_RUN) $(CORE_EXTRAS) pytest tests/core
test-xdr:
$(UV_RUN) $(CORE_EXTRAS) pytest tests/xdr
test-xfit:
$(UV_RUN) $(CORE_EXTRAS) pytest tests/xfit
test-xfit-real:
$(UV_RUN) $(CORE_EXTRAS) pytest -rs -m real_data tests/xfit/test_real_data.py
test-ximage:
$(UV_RUN) $(CPU_EXTRAS) pytest tests/ximage
test-xpois:
$(UV_RUN) $(VIZ_EXTRAS) pytest tests/xpois
test-xscan:
$(UV_RUN) $(CPU_EXTRAS) pytest tests/xscan
test-xrep:
$(UV_RUN) $(CPU_EXTRAS) pytest tests/xrep
test-xray:
$(UV_RUN) $(VIZ_EXTRAS) pytest tests/xray
test-xbeam:
$(UV_RUN) --extra dev pytest tests/xbeam
.PHONY: test-xlens
test-xlens:
$(UV_RUN) --extra dev --extra xlens-inference pytest tests/xlens
test-gpu:
$(UV_RUN) $(GPU_EXTRAS) --extra ximage --extra catalog pytest
test-cutile:
$(UV_RUN) $(GPU_EXTRAS) --extra cutile pytest tests/xfit tests/xpois
clean-dist:
rm -rf dist
build:
rm -f dist/cuphoton-*.tar.gz
CUPHOTON_XDR_BUILD_EXT=0 uv build --sdist
wheels: build
rm -f dist/cuphoton-*.whl
uv tool run --from cibuildwheel==4.2.1 cibuildwheel --platform linux --output-dir dist dist/*.tar.gz
conda: build
rm -rf dist/conda
pixi exec --spec rattler-build=0.76.1 --spec python=3.12 -- python scripts/conda/build.py dist/*.tar.gz
package-check: build
uvx --isolated --from twine==6.2.0 twine check --strict dist/*.tar.gz
release-check:
$(MAKE) lock-check
$(MAKE) requirements-check
$(MAKE) ci-lint
$(MAKE) ci-test-cpu
$(MAKE) wheels
python scripts/wheels/check_distributions.py dist --arch "$$(uname -m)"
uvx --isolated --from twine==6.2.0 twine check --strict dist/*.tar.gz dist/*.whl
ci-lint:
$(MAKE) lint
$(UV_RUN) --extra dev pre-commit run --all-files --show-diff-on-failure
ci-test-cpu: test-cpu
hooks:
$(UV_RUN) --extra dev pre-commit install
$(UV_RUN) --extra dev pre-commit run --all-files --show-diff-on-failure