-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
214 lines (183 loc) · 6.18 KB
/
pyproject.toml
File metadata and controls
214 lines (183 loc) · 6.18 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
[project]
name = "usansred"
description = "Reduction backend for USANS"
authors = [
{ name = "Yingrui Shang" },
{ name = "Jose Borreguerro" },
{ name = "Glass Elsarboukh" },
]
dynamic = ["version"]
requires-python = ">=3.11"
license = { text = "MIT" }
[project.urls]
homepage = "https://github.com/neutrons/usansred/"
[project.scripts]
reduceUSANS = "usansred.reduce:main"
#####################################
# BUILDING FROM SOURCES WITH HATCH
#####################################
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "versioningit"]
[tool.hatch.version]
source = "versioningit"
[tool.hatch.build.hooks.versioningit-onbuild]
source-file = "src/usansred/_version.py"
build-file = "usansred/_version.py"
[tool.hatch.build]
artifacts = [
"reduction/usansred/_version.py",
"reduction/usansred/**/*.yml",
"reduction/usansred/**/*.yaml",
"reduction/usansred/**/*.ini",
"src/usansred/**/*.json",
]
[tool.hatch.build.targets.wheel]
packages = ["src/usansred"]
#################
# VERSIONINGIT
#################
[tool.versioningit.vcs]
method = "git"
default-tag = "0.0.1"
[tool.versioningit.next-version]
method = "minor"
[tool.versioningit.format]
distance = "{next_version}.dev{committer_date:%Y%m%d%H%M%S}"
dirty = "{version}"
distance-dirty = "{next_version}.dev{committer_date:%Y%m%d%H%M%S}"
[tool.versioningit.write]
file = "src/usansred/_version.py"
[tool.pytest.ini_options]
pythonpath = [".", "src", "scripts"]
testpaths = ["tests"]
python_files = ["test*.py"]
norecursedirs = [
".git",
"tmp*",
"_tmp*",
"__pycache__",
"*dataset*",
"*data_set*",
]
markers = [
"datarepo: using repository usansred-data",
"sns_mounted: requires the /SNS filesystem",
]
[tool.ruff]
line-length = 120
# https://beta.ruff.rs/docs/rules/
lint.select = ["A", "ARG", "BLE", "E", "F", "I", "PT"]
lint.ignore = [
"F403",
"F405",
"F401", # wild imports and unknown names
]
###################
### Pixi config ###
###################
[tool.pixi.workspace]
name = "usansred"
preview = ["pixi-build"]
platforms = ["linux-64"]
channels = [
"conda-forge",
"mantid/label/main",
"neutrons",
"https://prefix.dev/pixi-build-backends"
]
[tool.pixi.environments]
default = { features = [
"test",
"package",
"docs",
"developer",
], solve-group = "default" }
docs = { features = ["docs"], solve-group = "docs" }
[tool.pixi.pypi-dependencies]
usansred = { path = ".", editable = true }
[tool.pixi.dependencies]
python = "=3.11"
mantidworkbench = ">=6.15.0,<6.16.0"
pandas = "*"
pydantic = "*"
xlsxwriter = "*"
finddata = { version = "=0.10.1", channel = "neutrons" }
jsonschema = "*"
# Conda packages (no PyPi) to be enumerated within the conda package to be built.
[tool.pixi.package.run-dependencies]
python = "=3.11"
mantidworkbench = ">=6.15.0,<6.16.0"
pandas = "*"
pydantic = "*"
xlsxwriter = "*"
finddata = { version = "=0.10.1", channel = "neutrons" }
jsonschema = "*"
[tool.pixi.package]
name = "usansred"
version = "1.0.0" # placeholder, overwritten by sync-version
[tool.pixi.package.build]
backend = { name = "pixi-build-python", version = "0.4.*"}
[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" }
test-datalight = { description = "Run tests not using the data repo nor the SNS mount", cmd = "COVERAGE_FILE=.coverage.datalight python -m pytest -vv -m \"not datarepo and not sns_mounted\" --cov=src --cov-report=term-missing tests/" }
test-datarepo = { description = "Run tests using the data repo", cmd = "git submodule update --init && COVERAGE_FILE=.coverage.datarepo python -m pytest -vv -m \"datarepo and not sns_mounted\" --cov=src --cov-report=term-missing tests/" }
combine-coverage = { description = "Combine coverage reports", cmd = "coverage combine && coverage xml" }
# Packaging
pypi-build = { cmd = "hatch build", description = "Build the package for PyPI" }
conda-build-command = { cmd = "pixi build", description = "Build the conda package command" }
conda-build = { description = "Build the conda package", depends-on = [
"backup-toml",
"sync-version",
"conda-build-command",
"reset-toml",
] }
conda-publish = { cmd = "anaconda upload *.conda", description = "Publish the .conda package to anaconda.org", depends-on = [
"conda-build",
] }
# Misc
audit-deps = { cmd = "pip-audit --local -s osv", description = "Audit the package dependencies for vulnerabilities" }
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",
] }
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" }
[tool.pixi.feature.test.dependencies]
pytest = "*"
pytest-cov = "*"
pytest-repeat = "*"
pytest-xdist = "*"
[tool.pixi.feature.package.dependencies]
anaconda-client = "*"
twine = ">=6.1.0,<7"
versioningit = "*"
hatch = "*"
python-build = "*"
[tool.pixi.feature.package.pypi-dependencies]
toml-cli = "*"
[tool.pixi.feature.developer.dependencies]
pip = "*"
pip-audit = "*"
pre-commit = "*"
ruff = "*"
versioningit = "*"
argcomplete = "*"
[tool.pixi.feature.docs.dependencies]
sphinx = "*"
sphinx_rtd_theme = "*"
[tool.pixi.package.host-dependencies]
hatchling = "*"
versioningit = "*"
# Add additional 3rd party tool configuration here as needed