forked from scikit-hep/pyhf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
321 lines (301 loc) · 9.9 KB
/
pyproject.toml
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
315
316
317
318
319
320
321
[build-system]
requires = [
"hatchling>=1.13.0",
"hatch-vcs>=0.3.0",
]
build-backend = "hatchling.build"
[project]
name = "pyhf"
dynamic = ["version"]
description = "pure-Python HistFactory implementation with tensors and autodiff"
readme = "README.rst"
license = { text = "Apache-2.0" } # SPDX short identifier
requires-python = ">=3.8"
authors = [
{ name = "Lukas Heinrich", email = "lukas.heinrich@cern.ch" },
{ name = "Matthew Feickert", email = "matthew.feickert@cern.ch" },
{ name = "Giordon Stark", email = "gstark@cern.ch" },
]
maintainers = [ {name = "The Scikit-HEP admins", email = "scikit-hep-admins@googlegroups.com"} ]
keywords = [
"fitting",
"jax",
"numpy",
"physics",
"pytorch",
"scipy",
"tensorflow",
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: WebAssembly :: Emscripten",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"click>=8.0.0", # for console scripts
"importlib_resources>=1.4.0; python_version < '3.9'", # for resources in schema
"jsonpatch>=1.15",
"jsonschema>=4.15.0", # for utils
"pyyaml>=5.1", # for parsing CLI equal-delimited options
"scipy>=1.5.2", # requires numpy, which is required by pyhf and tensorflow
"tqdm>=4.56.0", # for readxml
"numpy", # compatible versions controlled through scipy
]
[project.scripts]
pyhf = "pyhf.cli:cli"
[project.urls]
Documentation = "https://pyhf.readthedocs.io/"
Homepage = "https://github.com/scikit-hep/pyhf"
"Issue Tracker" = "https://github.com/scikit-hep/pyhf/issues"
"Release Notes" = "https://pyhf.readthedocs.io/en/stable/release-notes.html"
"Releases" = "https://github.com/scikit-hep/pyhf/releases"
"Source Code" = "https://github.com/scikit-hep/pyhf"
[project.optional-dependencies]
shellcomplete = ["click_completion"]
# TODO: 'tensorflow' supports all platform_machine for tensorflow v2.16.1+
# but TensorFlow only supports python_version 3.8 up through tensorflow v2.13.1.
# So until Python 3.8 support is dropped, split requirments on python_version
# before and after 3.9.
# NOTE: macos x86 support is deprecated from tensorflow v2.17.0 onwards.
tensorflow = [
# python == 3.8
"tensorflow>=2.7.0; python_version < '3.9' and platform_machine != 'arm64'", # c.f. PR #1962, #2452
"tensorflow-macos>=2.7.0; python_version < '3.9' and platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #2119, #2452
"tensorflow-probability>=0.11.0; python_version < '3.9'", # c.f. PR #1657, #2452
# python >= 3.9
"tensorflow-probability[tf]>=0.24.0; python_version >= '3.9'" # c.f. PR #2452
]
torch = ["torch>=1.10.0"] # c.f. PR #1657
jax = [
"jax>=0.4.1", # c.f. PR #2079
"jaxlib>=0.4.1", # c.f. PR #2079
]
xmlio = ["uproot>=4.1.1"] # c.f. PR #1567
minuit = ["iminuit>=2.7.0"] # c.f. PR #1895
contrib = [
"matplotlib>=3.0.0",
"requests>=2.22.0",
]
backends = ["pyhf[tensorflow,torch,jax,minuit]"]
all = ["pyhf[backends,xmlio,contrib,shellcomplete]"]
# Developer extras
test = [
"scikit-hep-testdata>=0.4.11",
"pytest>=6.0",
"coverage[toml]>=6.0.0",
"pytest-mock",
"requests-mock>=1.9.0",
"pytest-benchmark[histogram]",
"pytest-console-scripts>=1.4.0",
"pytest-mpl",
"ipympl>=0.3.0",
"pydocstyle",
"papermill>=2.5.0",
"scrapbook>=0.5.0",
"jupyter",
"graphviz",
"pytest-socket>=0.2.0", # c.f. PR #1917
]
docs = [
"pyhf[xmlio,contrib]",
"sphinx>=7.0.0", # c.f. https://github.com/scikit-hep/pyhf/pull/2271
"sphinxcontrib-bibtex>=2.1",
"sphinx-click",
"sphinx-rtd-theme>=1.3.0", # c.f. https://github.com/scikit-hep/pyhf/pull/2271
"nbsphinx!=0.8.8", # c.f. https://github.com/spatialaudio/nbsphinx/issues/620
"ipywidgets",
"sphinx-issues",
"sphinx-copybutton>=0.3.2,!=0.5.1",
"jupyterlite-sphinx>=0.13.1", # c.f. https://github.com/scikit-hep/pyhf/pull/2458
"jupyterlite-pyodide-kernel>=0.0.7",
"jupytext>=1.14.0",
"ipython!=8.7.0", # c.f. https://github.com/scikit-hep/pyhf/pull/2068
]
develop = [
"pyhf[all,test,docs]",
"tbump>=6.7.0",
"pre-commit",
"nox",
"codemetapy>=2.3.0",
"uv>=0.1.39"
]
[tool.hatch.version]
source = "vcs"
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"
[tool.hatch.build.hooks.vcs]
version-file = "src/pyhf/_version.py"
[tool.hatch.build.targets.sdist]
# only-include needed to properly include src/pyhf/schemas
# c.f. https://github.com/pypa/hatch/pull/299
# hatchling always includes:
# pyproject.toml, .gitignore, any README, any LICENSE, AUTHORS
only-include = [
"/src",
"/CITATION.cff"
]
exclude = [
"/src/conftest.py"
]
[tool.hatch.build.targets.wheel]
packages = ["src/pyhf"]
[tool.black]
line-length = 88
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.git
| .eggs
| build
| .nox
)/
'''
[tool.pytest.ini_options]
minversion = "6.0"
xfail_strict = true
addopts = [
"-ra",
"--showlocals",
"--strict-markers",
"--strict-config",
"--doctest-modules",
"--doctest-glob='*.rst'",
]
log_cli_level = "info"
testpaths = "tests"
markers = [
"fail_jax",
"fail_numpy",
"fail_numpy_minuit",
"fail_pytorch",
"fail_pytorch64",
"fail_tensorflow",
"only_jax",
"only_numpy",
"only_numpy_minuit",
"only_pytorch",
"only_pytorch64",
"only_tensorflow",
"skip_jax",
"skip_numpy",
"skip_numpy_minuit",
"skip_pytorch",
"skip_pytorch64",
"skip_tensorflow",
]
filterwarnings = [
"error",
'ignore:the imp module is deprecated:DeprecationWarning', # tensorflow
'ignore:distutils Version classes are deprecated:DeprecationWarning', # tensorflow-probability
'ignore:the `interpolation=` argument to percentile was renamed to `method=`, which has additional options:DeprecationWarning', # Issue #1772
"ignore:The interpolation= argument to 'quantile' is deprecated. Use 'method=' instead:DeprecationWarning", # Issue #1772
'ignore: Exception ignored in:pytest.PytestUnraisableExceptionWarning', #FIXME: Exception ignored in: <_io.FileIO [closed]>
'ignore:invalid value encountered in (true_)?divide:RuntimeWarning', #FIXME
'ignore:invalid value encountered in add:RuntimeWarning', #FIXME
"ignore:In future, it will be an error for 'np.bool_' scalars to be interpreted as an index:DeprecationWarning", #FIXME: tests/test_tensor.py::test_pdf_eval[pytorch]
'ignore:Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with:UserWarning', #FIXME: tests/test_optim.py::test_minimize[no_grad-scipy-pytorch-no_stitch]
'ignore:divide by zero encountered in (true_)?divide:RuntimeWarning', #FIXME: pytest tests/test_tensor.py::test_pdf_calculations[numpy]
'ignore:[A-Z]+ is deprecated and will be removed in Pillow 10:DeprecationWarning', # keras
'ignore:Call to deprecated create function:DeprecationWarning', # protobuf via tensorflow
'ignore:`np.bool8` is a deprecated alias for `np.bool_`:DeprecationWarning', # numpy via tensorflow
"ignore:module 'sre_constants' is deprecated:DeprecationWarning", # tensorflow v2.12.0+ for Python 3.11+
"ignore:ml_dtypes.float8_e4m3b11 is deprecated.", #FIXME: Can remove when jaxlib>=0.4.12
"ignore:jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the:DeprecationWarning", # Issue #2139
"ignore:Skipping device Apple Paravirtual device that does not support Metal 2.0:UserWarning", # Can't fix given hardware/virtualized device
'ignore:Type google._upb._message.[A-Z]+ uses PyType_Spec with a metaclass that has custom:DeprecationWarning', # protobuf via tensorflow
]
[tool.coverage.run]
source = ["pyhf"]
branch = true
omit = ["*/pyhf/typing.py"]
[tool.coverage.report]
precision = 1
sort = "cover"
show_missing = true
exclude_also = [
"if TYPE_CHECKING:"
]
[tool.mypy]
files = "src"
python_version = "3.12"
warn_unused_configs = true
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
[[tool.mypy.overrides]]
module = [
'jax.*',
'matplotlib.*',
'scipy.*',
'tensorflow.*',
'tensorflow_probability.*',
'torch.*',
'uproot.*',
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
'pyhf',
'pyhf.optimize.*',
'pyhf.contrib.*',
'pyhf.infer.*',
'pyhf.interpolators.*',
'pyhf.cli.*',
'pyhf.modifiers.*',
'pyhf.exceptions.*',
'pyhf.parameters.*',
'pyhf.schema.*',
'pyhf.writexml',
'pyhf.workspace',
'pyhf.patchset',
'pyhf.compat',
'pyhf.events',
'pyhf.utils',
'pyhf.constraints',
'pyhf.pdf',
'pyhf.simplemodels',
'pyhf.probability',
'pyhf.tensor.common.*',
'pyhf.tensor',
'pyhf.tensor.jax_backend.*',
'pyhf.tensor.tensorflow_backend.*',
'pyhf.tensor.pytorch_backend.*',
]
ignore_errors = true
[tool.ruff]
src = ["src"]
line-length = 88
[tool.ruff.lint]
select = [
"E", "F", "W", # flake8
"UP", # pyupgrade
"RUF", # Ruff-specific
"TID", # flake8-tidy-imports
]
ignore = [
"E402",
"E501",
"RUF001", # String contains ambiguous unicode character
"RUF005", # unpack-instead-of-concatenating-to-collection-literal
]
typing-modules = ["pyhf.typing"]
unfixable = [
"F841", # Removes unused variables
]
flake8-tidy-imports.ban-relative-imports = "all"
[tool.ruff.lint.per-file-ignores]
"docs/lite/jupyterlite.py" = ["F401", "F704"]
"**.ipynb" = ["F821", "F401", "F841", "F811", "E703"]