-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpyproject.toml
More file actions
314 lines (271 loc) · 9.81 KB
/
pyproject.toml
File metadata and controls
314 lines (271 loc) · 9.81 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
[project]
name = "pyrs"
description = "Data reduction and visualization of neutron data measured at the HFIR HB2B instrument"
dynamic = ["version"]
requires-python = ">=3.11"
license = { text = "MIT" }
keywords = ["neutrons", "python"]
readme = "README.rst"
[project.scripts]
pyrsplot = "scripts.pyrsplot:main"
pyrs-calibration = "scripts.pyrs_calibration:main"
pyrs-calibration-correlation = "scripts.pyrs_calibration_correlation:main"
create-mask = "scripts.create_mask:main"
####################
### Build config ###
####################
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "versioningit"]
[tool.hatch.version]
source = "versioningit"
[tool.hatch.build.hooks.versioningit-onbuild]
source-file = "pyrs/_version.py"
build-file = "pyrs/_version.py"
[tool.hatch.build]
artifacts = [
"pyrs/_version.py",
"pyrs/**/*.yml",
"pyrs/**/*.yaml",
"pyrs/**/*.ini",
]
[tool.hatch.build.targets.wheel]
packages = ["pyrs", "scripts"]
[tool.versioningit.vcs]
method = "git"
default-tag = "0.1.0"
[tool.versioningit.next-version]
method = "minor"
[tool.versioningit.format]
distance = "{next_version}.dev{distance}"
# Since pixi builds currently require the package version to be set statically in pyproject.toml,
# and we solve that by temporarily changing pyproject.toml during build using the pixi tasks
# sync-version and reset-toml, then we need to ignore uncommitted changes in order for the wheel
# version to be consistent with the package version
dirty = "{version}"
distance-dirty = "{next_version}.dev{distance}"
[tool.versioningit.write]
file = "pyrs/_version.py"
[tool.pixi.workspace]
preview = ["pixi-build"]
channels = [
"conda-forge",
# Prefer ORNL-specific Mantid builds first so strict channel priority
# doesn't exclude needed mantidqt/mantidworkbench candidates.
"mantid-ornl/label/main", # ORNL-specific stable releases
"mantid-ornl/label/rc", # Fallback to RC if stable not available
"mantid-ornl/label/nightly", # ORNL-specific nightly builds
"mantid/label/main", # Primary source for stable Mantid releases
"mantid/label/nightly", # Upstream nightly builds
"https://prefix.dev/pixi-build-backends",
]
platforms = ["linux-64"]
[tool.pixi.dependencies]
python = "*"
pip = "*"
mantidworkbench = ">=6.15.0,<6.16.0"
qtpy = "*"
pyqt = "*"
uncertainties = "*"
libarchive = "*"
matplotlib = "*"
numpy = "*"
pandas = "*"
types-six = "*"
nexusformat = ">=1.0.8,<2"
pydantic = ">=2.7.3,<3"
h5glance = ">=0.9,<0.10"
[tool.pixi.pypi-dependencies]
# PyPI dependencies, including this package to allow local editable installs
pyrs = { path = ".", editable = true }
[tool.pixi.package.host-dependencies]
hatchling = "*"
versioningit = "*"
[tool.pixi.package.run-dependencies]
mantidworkbench = ">=6.15.0,<6.16.0"
qtpy = "*"
pyqt = "*"
uncertainties = "*"
libarchive = "*"
matplotlib = "*"
numpy = "*"
pandas = "*"
types-six = "*"
nexusformat = ">=1.0.8,<2"
pydantic = ">=2.7.3,<3"
# ------------------------------- #
# Pixi Feature Dependencies #
# ------------------------------- #
[tool.pixi.feature.test.dependencies]
pytest = "*"
pytest-qt = "*"
pytest-cov = "*"
mypy = "*"
[tool.pixi.feature.package.dependencies]
anaconda-client = "*"
conda-build = "*"
twine = "*"
versioningit = "*"
hatch = "*"
toml = "*"
# fix for pip audit
# cryptography = ">=46.0.6" ## TODO: not indexed yet: CVE-2026-34073 ##
h11 = ">=0.16.0"
py-lief = ">=0.17.2"
requests = ">=2.33.0"
[tool.pixi.feature.package.pypi-dependencies]
toml-cli = "*"
[tool.pixi.feature.developer.dependencies]
pre-commit = "*"
mypy = "*"
python-build = "*"
pip-audit = "*"
[tool.pixi.feature.docs.dependencies]
sphinx = "*"
sphinx_rtd_theme = "*"
sphinxcontrib-mermaid = "*"
sphinxcontrib-programoutput = "*"
types-pyyaml = "*"
versioningit = "*"
# ------------------------------- #
# Development Environment Feature #
# ------------------------------- #
[tool.pixi.feature.dev.dependencies]
python = "*"
pip = "*"
mantidworkbench = { version = ">=6.15.0", channel = "mantid/label/nightly" }
mantid = { channel = "mantid/label/nightly" }
mantidqt = { channel = "mantid/label/nightly" }
uncertainties = "*"
libarchive = "*"
pandas = "*"
types-six = "*"
nexusformat = ">=1.0.8,<2"
pydantic = ">=2.7.3,<3"
# ------------------------------- #
# QA Environment Feature #
# ------------------------------- #
[tool.pixi.feature.qa.dependencies]
python = "*"
pip = "*"
mantidworkbench = { version = ">=6.15.0,<6.16.0", channel = "mantid-ornl/label/rc" }
mantid = { channel = "mantid-ornl/label/rc" }
mantidqt = { channel = "mantid-ornl/label/rc" }
uncertainties = "*"
libarchive = "*"
pandas = "*"
types-six = "*"
nexusformat = ">=1.0.8,<2"
pydantic = ">=2.7.3,<3"
# ------------------------------- #
# Production Environment Feature #
# ------------------------------- #
[tool.pixi.feature.prod.dependencies]
python = "*"
pip = "*"
mantidworkbench = { version = ">=6.15.0,<6.16.0", channel = "mantid/label/main" }
mantid = { channel = "mantid/label/main" }
mantidqt = { channel = "mantid/label/main" }
uncertainties = "*"
libarchive = "*"
pandas = "*"
types-six = "*"
nexusformat = ">=1.0.8,<2"
pydantic = ">=2.7.3,<3"
[tool.pixi.package]
name = "pyrs"
version = "0.0.0" # placeholder, overwritten by sync-version
[tool.pixi.package.build.backend]
name = "pixi-build-python"
version = "*"
channels = [
"conda-forge",
"mantid-ornl/label/main", # ORNL-specific stable releases
"mantid-ornl/label/rc", # Fallback to RC if stable not available
"mantid-ornl/label/nightly", # ORNL-specific nightly builds
"mantid/label/main", # Primary source for stable Mantid releases
"mantid/label/nightly", # Upstream nightly builds
"https://prefix.dev/pixi-build-backends",
"https://prefix.dev/conda-forge",
]
[tool.pixi.environments]
default = { features = [
"docs",
"developer",
"dev",
"package",
"test",
], solve-group = "default" }
# Production environment with stable Mantid versions
prod = { features = ["test", "package", "docs", "prod"], solve-group = "prod" }
# Development environment with nightly Mantid builds
dev = { features = ["test", "package", "docs", "dev"], solve-group = "dev" }
# QA environment with RC or prod packages
qa = { features = ["test", "package", "docs", "qa"], solve-group = "qa" }
# Environment-specific channel configurations
[tool.pixi.feature.dev.activation.env]
# Development environment can use nightly builds
MANTID_CHANNEL_PRIORITY = "nightly"
[tool.pixi.feature.qa.activation.env]
# QA environment uses RC or prod packages
MANTID_CHANNEL_PRIORITY = "rc_prod"
[tool.pixi.feature.prod.activation.env]
# Production environment uses only stable releases
MANTID_CHANNEL_PRIORITY = "stable_only"
# --------------- #
# Pixi Tasks #
# --------------- #
[tool.pixi.tasks]
# PyPi packaging tasks
build-pypi = { cmd = "hatch build", description = "Build the package for PyPI" }
publish-pypi = { cmd = "twine upload dist/*", description = "Publish the package to PyPI", depends-on = [
"build-pypi",
] }
publish-pypi-test = { cmd = "twine upload --repository testpypi dist/*", description = "Publish the package to TestPyPI", depends-on = [
"build-pypi",
] }
clean-pypi = { cmd = "rm -rf dist", description = "Clean the PyPI build artifacts" }
# Conda packaging tasks
build-conda-command = { cmd = "pixi build", description = "Build the conda package command" }
build-conda = { description = "Build the conda package", depends-on = [
"backup-toml",
"sync-version",
"build-conda-command",
"reset-toml",
] }
publish-conda = { cmd = "anaconda upload *.conda", description = "Publish the .conda package to anaconda.org", depends-on = [
"build-conda",
] }
clean-conda = { cmd = "rm -f *.conda", description = "Clean the local .conda build artifacts" }
# Documentation tasks
build-docs = { cmd = "sphinx-build -b html docs/user/source docs/_build/user", description = "Build the User documentation" }
build-dev-docs = { cmd = "sphinx-build -b html docs/developer/source docs/_build/developer", description = "Build the Developer documentation" }
clean-docs = { cmd = "rm -rf docs/_build", description = "Clean the documentation build artifacts" }
docs-serve = { cmd = "python -m http.server 8000 -d docs/_build/user", description = "Serve User documentation locally on port 8000" }
docs-autobuild = { cmd = "sphinx-autobuild docs/user/source docs/_build/user --host 0.0.0.0 --port 8000", description = "Auto-rebuild and serve User docs on changes" }
# Testing tasks
test = { cmd = "pytest --cov=pyrs --cov-report=xml --cov-report=term ./tests", description = "Run the tests with coverage" }
test-import-framework = { cmd = "python -c 'import pyrs'; python -c 'import qtpy'; python -c 'import mantidqt'", description = "Test import of main dependencies" }
# MISC
audit-deps = { cmd = "pip-audit --local -s osv --ignore-vuln CVE-2026-4539 --ignore-vuln CVE-2026-34073", description = "Audit the package dependencies for vulnerabilities" }
clean-all = { description = "Clean all build artifacts", depends-on = [
"clean-pypi",
"clean-docs",
"clean-conda",
] }
sync-version = { cmd = 'version=$(python -m versioningit); toml set tool.pixi.package.version "$version" --toml-path pyproject.toml', description = "Sync pyproject.toml version with Git version" }
backup-toml = { cmd = "cp pyproject.toml pyproject.toml.bak", description = "Backup the pyproject.toml file" }
reset-toml = { cmd = "cp pyproject.toml.bak pyproject.toml; rm pyproject.toml.bak", description = "Reset the pyproject.toml file to the original state" }
# Application tasks
pyrs = { cmd = "pyrsplot", description = "Start the pyrs application" }
[tool.mypy]
ignore_missing_imports = true
namespace_packages = true
[tool.ruff]
line-length = 119
target-version = "py311"
exclude = ["pyrs/icons", "scripts"]
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
[tool.ruff.format]
line-ending = "lf"