-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
261 lines (219 loc) · 7.78 KB
/
Copy pathpyproject.toml
File metadata and controls
261 lines (219 loc) · 7.78 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
########################
### Project Metadata ###
########################
[project]
name = "vnext"
description = "Data reduction for VULCAN"
dynamic = ["version"]
requires-python = ">=3.12"
license = { text = "MIT" }
keywords = ["neutrons", "python"]
readme = "README.md"
dependencies = [
# Dependencies available from both PyPI and conda should be listed here
"ipython>=9.9.0,<10",
]
[project.optional-dependencies]
docs = ["sphinx", "sphinx_rtd_theme", "myst_parser", "toml"]
[project.scripts]
vnext = "vnext.vconsole:main"
[project.urls]
homepage = "https://github.com/neutrons/vnext/"
repository = "https://github.com/neutrons/vnext/"
# documentation = add_url_to_readthedoc_here
issues = "https://github.com/neutrons/vnext/issues"
####################
### Build config ###
####################
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "versioningit"]
[tool.hatch.version]
source = "versioningit"
[tool.hatch.build.hooks.versioningit-onbuild]
source-file = "src/vnext/_version.py"
build-file = "vnext/_version.py"
[tool.hatch.build]
artifacts = [
"src/vnext/_version.py",
"src/vnext/**/*.yml",
"src/vnext/**/*.yaml",
"src/vnext/**/*.ini",
]
[tool.hatch.build.targets.wheel]
packages = ["src/vnext"]
[tool.versioningit.vcs]
method = "git"
default-tag = "0.1.0"
[tool.versioningit.next-version]
method = "minor"
[tool.versioningit.format]
distance = "{next_version}.dev{committer_date:%Y%m%d%H%M%S}"
# Pixi builds temporarily rewrite pyproject.toml to inject a static package version,
# so ignore that local change when deriving the wheel version.
dirty = "{version}"
distance-dirty = "{next_version}.dev{committer_date:%Y%m%d%H%M%S}"
[tool.versioningit.write]
file = "src/vnext/_version.py"
###################
### Pixi config ###
###################
[tool.pixi.workspace]
preview = ["pixi-build"] # Required until the build feature becomes stable
channels = [
"conda-forge",
"mantid-ornl", # Required for pixi build
"mantid-ornl/label/rc", # Required for pixi build
"mantid",
"neutrons", # Provides neutrons_standard
]
platforms = [
"linux-64",
] # add additional platforms as needed, but the ornl-fork only supports linux
# If you don't need to map PyPI dependencies to conda, you can remove the `conda-pypi-map` section and the `pixi-mapping.json` file.
conda-pypi-map = { "conda-forge" = "pixi-mapping.json" }
## Dependency tables - https://pixi.sh/latest/reference/pixi_manifest/#the-dependencies-tables
## These tables override the dependencies listed in the [project] section
[tool.pixi.dependencies]
h2 = ">=4.3.0" # Known vulnerability in <4.3.0
brotli = ">=1.2.0"
ipython = ">=9.9.0,<10"
mantid = ">=6.16.0,<7.0"
mantidprofiler = ">=1.4,<2"
matplotlib = "*" # mantidqt and mantidworkbench both require matplotlib
neutrons_standard = "*" # shared Config/infrastructure from the neutrons channel
[tool.pixi.pypi-dependencies]
# PyPI dependencies, including this package to allow local editable installs
vnext = { path = ".", editable = true }
# Pixi Build configuration - https://pixi.sh/latest/reference/pixi_manifest/#pixi-build
[tool.pixi.package.host-dependencies]
hatchling = "*"
versioningit = "*"
[tool.pixi.package.run-dependencies]
mantid = ">=6.16.0,<7.0"
mantidprofiler = ">=1.4,<2"
matplotlib = "*" # mantidqt and mantidworkbench both require matplotlib
ipython = ">=9.9.0,<10"
neutrons_standard = "*" # shared Config/infrastructure from the neutrons channel
[tool.pixi.package]
name = "vnext"
version = "0.0.0" # placeholder, overwritten by sync-version
[tool.pixi.package.build]
backend = { name = "pixi-build-python", version = ">=0.5" }
# Environments and Features
[tool.pixi.environments]
default = { features = [
"docs",
"developer",
"package",
"test",
], solve-group = "default" }
[tool.pixi.feature.test.dependencies]
pytest = ">=9.0.3,<10.0"
pytest-cov = "*"
pytest-repeat = "*"
pytest-xdist = "*"
[tool.pixi.feature.package.dependencies]
anaconda-client = ">=1.13.0,<2"
twine = ">=6.1.0,<7"
hatch = "*"
versioningit = "*"
[tool.pixi.feature.package.pypi-dependencies]
toml-cli = "*"
[tool.pixi.feature.developer.dependencies]
pip = ">=25.3"
pre-commit = "*"
pixi-pycharm = ">=0.0.10,<0.0.11"
ty = ">=0.0.40"
versioningit = "*"
[tool.pixi.feature.docs.dependencies]
sphinx = "*"
sphinx_rtd_theme = "*"
myst-parser = "*"
toml = "*"
[tool.pixi.tasks]
# Documentation
build-docs = { cmd = 'sphinx-build -b html docs docs/_build', description = "Build documentation" }
test-docs = { cmd = "sphinx-build -M doctest docs docs/_build", description = "Test building the documentation" }
# Testing
test = { description = "Run the test suite", cmd = "pytest" }
# Packaging
pypi-sdist = { cmd = "hatch build -t sdist", description = "Build the source distribution (tar.gz)" }
pypi-wheel = { cmd = "hatch build -t wheel", description = "Build the wheel distribution" }
pypi-build = { description = "Build the packages for PyPI", depends-on = [
"pypi-sdist",
"pypi-wheel",
] }
pypi-publish = { cmd = "twine upload dist/*", description = "Publish the package to PyPI", depends-on = [
"pypi-build",
] }
pypi-publish-test = { cmd = "twine upload --repository testpypi dist/*", description = "Publish the package to TestPyPI", depends-on = [
"pypi-build",
] }
conda-publish = { cmd = "anaconda upload *.conda", description = "Publish the .conda package to anaconda.org", depends-on = [
"conda-build",
] }
# Cleaning
clean = { cmd = 'rm -rf .pytest_cache .ruff_cache **/*.egg-info **/dist **/__pycache__', description = "Clean up various caches and build artifacts" }
clean-conda = { cmd = "rm -f *.conda", description = "Clean the local .conda build artifacts" }
clean-docs = { cmd = "rm -rf docs/_build", description = "Clean up documentation build artifacts" }
clean-pypi = { cmd = "rm -rf dist", description = "Clean the PyPI build artifacts" }
clean-all = { description = "Clean all artifacts", depends-on = [
"clean",
"clean-conda",
"clean-docs",
"clean-pypi",
] }
# workaround for dynamic versioning
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" }
conda-build = { description = "Build the conda package", depends-on = [
"backup-toml",
"sync-version",
"conda-build-command",
"reset-toml",
] }
conda-build-command = { cmd = "pixi build", description = "Build the conda package command" }
vnext = { cmd = "vnext", description = "Launch the vnext interactive shell" }
ty-check = { cmd = "ty check {{filename}}", description = "Run ty check", default-environment = "developer", args = [
{ "arg" = "filename", "default" = "" },
] }
##############
### Pytest ###
##############
[tool.pytest.ini_options]
addopts = "-v --cov=vnext --cov-report=term-missing"
pythonpath = [".", "src", "scripts"]
testpaths = ["tests"]
python_files = ["test*.py"]
norecursedirs = [
".git",
"tmp*",
"_tmp*",
"__pycache__",
"*dataset*",
"*data_set*",
]
markers = ["mymarker: example markers goes here"]
############
### Ruff ###
############
[tool.ruff]
target-version = "py311"
line-length = 120
exclude = ["notebooks/**", "**/*.ipynb"]
[tool.ruff.lint]
select = ["A", "ARG", "ASYNC", "BLE", "C90", "E", "F", "I", "N", "UP032", "W"]
ignore = []
[tool.ruff.lint.isort]
known-first-party = ["vnext"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "auto"
[tool.ty.environment]
python = ".pixi/envs/default"
[tool.ty.rules]
# mantid.simpleapi is unresolvable (C++ extension loaded at runtime)
unresolved-import = "ignore"