-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
585 lines (501 loc) · 17.7 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
[tool.poetry]
name = "xpypact"
version = "0.12.3"
description = "\"Python workflow framework for FISPACT.\""
authors = ["dvp <[email protected]>"]
license = "MIT"
homepage = "https://github.com/MC-kit/xpypact"
repository = "https://github.com/MC-kit/xpypact"
documentation = "https://xpypact.readthedocs.io"
keywords = [
"element",
"nuclide",
"isotope",
"abundance",
"FISPACT",
"activation",
"duckdb",
"polars",
]
readme = "README.rst"
packages = [{ include = "xpypact", from = "src" }]
# Select from PyPI classifiers: https://pypi.org/classifiers/
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Physics",
]
[build-system]
requires = ["poetry-core >= 1.8.3"]
build-backend = "poetry.core.masonry.api"
# [tool.poetry.scripts]
# xpypact = "xpypact.cli.runner:xpypact"
[tool.poetry.urls]
documentation = "https://xpypact.readthedocs.io"
Changelog = "https://github.com/MC-kit/xpypact/releases"
[tool.poetry.dependencies]
python = ">=3.10,<3.14"
duckdb = ">=1.0.0"
mckit-nuclides = ">=0.3.2"
multipledispatch = ">=0.6.0"
numpy = ">=2.0"
polars = {version = ">=1.12.0", extras = ["all"]}
pyarrow = ">=18.0.0"
rich = ">=13.7.0"
msgspec = {git = "https://github.com/jcrist/msgspec.git", rev = "main"} # TODO: switch back to PyPI on update to Python 3.13
[tool.poetry.group.dev.dependencies]
Pygments = ">=2.10.0"
nox = ">=2022.1.7"
tomli = { version = ">=2.0.1", python = "<3.11" }
#[tool.poetry.group.profile]
#optional = true
#[tool.poetry.group.profile.dependencies]
# TODO dvp: apply yappi: https://coderzcolumn.com/tutorials/python/yappi-yet-another-python-profiler
#yappi = ">=1.3.2"
[tool.poetry.group.pre_commit.dependencies]
pre-commit = ">=2.15.0"
rstcheck = ">=6.1.2"
pydocstringformatter = ">=0.7.3"
sqlfluff = ">=2.3.2"
pyupgrade = ">=3.15.0"
[tool.poetry.group.test.dependencies]
pytest = ">=7.1"
# pytest-cache = ">=1.0"
pytest-cov = ">=4.0"
# pytest-mock = ">=3.9"
# pytest-randomly = ">=3.12"
coverage = { version = ">=6.1.2", extras = ["toml"] }
xdoctest = { extras = ["colors"], version = ">=0.15.10" }
pytest-benchmark = ">=4.0.0"
[tool.poetry.group.coverage.dependencies]
coverage = { version = ">=6.1.2", extras = ["toml"] }
[tool.poetry.group.xdoctest.dependencies]
xdoctest = { extras = ["colors"], version = ">=0.15.10" }
[tool.poetry.group.typeguard.dependencies]
typeguard = ">=4.1.5"
[tool.poetry.group.mypy.dependencies]
mypy = ">=1.2.0"
pep8-naming = ">=0.12.1"
types-setuptools = ">=57.4.2"
numpy = ">=1.26.2"
[tool.poetry.group.docs.dependencies]
sphinx = ">=6.1.3"
sphinx-autodoc-typehints = ">=1.19.5"
[tool.poetry.group.docs_auto.dependencies]
sphinx-autobuild = ">=2021.3.14"
[tool.poetry.group.ruff.dependencies]
ruff = ">=0.0.259"
[tool.poetry.group.analysis]
optional = true
[tool.poetry.group.analysis.dependencies]
jupysql = ">=0.10.9"
jupyterlab = ">=4.0.12"
jupytext = ">=1.16.1"
matplotlib = ">=3.7.1"
xlsxwriter = "^3.1.9"
xlsx2csv = "^0.8.2"
[tool.pytest.ini_options]
minversion = "6.2"
cache_dir = '.cache/pytest'
norecursedirs = '''
*.egg-info
.*
build
data
dist
docs/_build
docs/examples
htmlcov
notebooks
tools
wrk
'''
python_functions = "test_* profile_*"
addopts = '''
-ra
-q
--tb=short
--doctest-modules
--strict-markers
--ignore setup.py
--failed-first
--xdoctest
'''
doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE ALLOW_BYTES"
testpaths = ["tests", "src"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
# xfail tests that pass should fail the test suite
xfail_strict = true
filterwarnings = [
"error",
'ignore:Implementing implicit namespace packages \(as specified in PEP 420\) is preferred to `pkg_resources.declare_namespace`',
"ignore:.*not typechecking multipledispatch.dispatcher.*UserWarning",
'ignore:.*io.FileIO \[closed\]',
'ignore:.*Deprecated call to `pkg_resources.declare_namespace',
'ignore:.*Implicit None on return values:DeprecationWarning',
# pandas 2.1.4 at python 3.12
'ignore:.*datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning',
# openpyxl 3.1.2 qt python 3.12
'ignore:.*datetime.datetime.utcnow\(\):DeprecationWarning'
]
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
[tool.xdoctest]
quiet = true
options = ""
[tool.coverage.paths]
source = ["src", ".nox/*/site-packages"]
[tool.coverage.run]
branch = true
source = ["src"]
omit = ["*_tab.py", "**/__init__.py"]
[tool.coverage.report]
show_missing = true
skip_covered = true
fail_under = 100
omit = ["*_tab.py", "**/__init__.py", "**/types.py"]
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
ignore_errors = true
sort = "Cover"
# MyPy config
# See https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
# https://dev.to/tusharsadhwani/the-comprehensive-guide-to-mypy-561m
[tool.mypy]
python_version = "3.12"
strict = true
follow_imports = "silent"
disallow_untyped_defs = true
files = "src/**/*.py"
plugins = ["numpy.typing.mypy_plugin"]
[[tool.mypy.overrides]]
module = [
"IPython.core.magic",
"IPython.core.magic_arguments",
"click",
"click.testing",
"dask.*",
"duckdb",
"loguru",
"mckit_nuclides.*",
"msgspec",
"multipledispatch",
"nox",
"numpy.testing",
"pandas",
"polars",
"pytest",
"scipy.constants",
"scipy.sparse",
"tomli",
"tomllib",
"xdoctest",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
"tomllib",
"tomli",
]
allow_redefinition = true
disable_error_code = "no-redef"
[tool.check-manifest]
ignore = [
"tests/*",
"tools/*",
"*.yaml",
"noxfile.py",
]
[tool.ipdb]
# For debugging in jupyterlab and ipython
# see https://github.com/gotcha/ipdb
context = 5
[tool.tryceratops]
include = ["src"]
experimental = true
[tool.pydocstringformatter]
write = true
style = "pep257"
exclude = ["tools/**", "src/**/*_parser.py", "src/**/*_tab.py"]
strip-whitespaces = true
max-line-length = 100
summary-quotes-same-line = true
[tool.pylint]
good-names-rgxs = ["."] # a single character variable is okay
logging-format-style = "new" # use {} in logging messages
deprecated-modules = ["six"]
extension-pkg-allow-list = ["duckdb"]
disable = [
"wrong-import-order" # this is `ruff format` responsibility
]
[tool.ruff]
target-version = "py310"
line-length = 100
# show an enumeration of all autofixed lint violations
show-fixes = true
# show source code snippets when reporting violations
output-format = "concise"
src = ["src", "tests"]
exclude = [
"*.egg-info",
".cache",
"__pycache__",
"adhoc",
"docs/source/conf.py",
"notebooks",
"wrk",
]
[tool.ruff.lint]
#see full list: https://beta.ruff.rs/docs/rules/#pyflakes-f
#or run 'ruff linter' to see a brief list
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"AIR", # Airflow https://airflow.apache.org/docs/apache-airflow/stable/index.html
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"COM", # flake8-commas
"D", # pydocstyle
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle
"EM", # flake8-errmsg
"ERA", # eradicate
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap https://adamj.eu/tech/2021/07/10/python-type-hints-how-to-avoid-the-boolean-trap
"FIX", # flake8-fixme
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-log
"N", # pep8-naming
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # Pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slot
"T10", # flake8-debugger
"T20", # flake8-print
"TD", # flake8-todos
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle 2
"YTT", # flake8-2020
]
#warning: The isort option `isort.split-on-trailing-comma` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.split-on-trailing-comma=false` or `format.skip-magic-trailing-comma=false`.
# Ignore rules that currently fail on the codebase
ignore = [
"ANN001", # ANN001 Missing type annotation for function argument: doesn't allow to use functools dispatching
# "ANN002", # ANN002 Missing type annotation for *drop_items: ... as above
"ANN101", # ANN101 Missing type annotation for self in method
"ANN102", # ANN102 Missing type annotation for cls in classmethod
# "ANN201", # Missing return type annotation for public function `mesh2com`
"ANN202", # ANN202 Missing return type annotation for protected function: ... dispatching
# "ANN204", # ANN204 Missing return type annotation for special method
# "ARG001", # Unused function argument: `expected`
# "B905", # B905 `zip()` without an explicit `strict=` parameter - ignore while support 3.9
# "C812", # C812 Missing trailing comma: black compatibility
# "C901", # too complex - ...
"COM812", # may cause conflicts when used with the ruff formatter
# "D100", # Missing docstring in public module
# "D101", # Missing docstring in public class
# "D102", # Missing docstring in public method
# "D103", # Missing docstring in public function
"D105", # D105 Missing docstring in magic method (__hash__, __eq__)
# "D104", # Missing docstring in public package
# "D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
# "D417", # Missing argument descriptions in the docstring: `config`, `ebins`, - TODO
# "E203", # E203: Whitespace before ‘:'
# "E401", # Multiple imports on one line
# "E402", # Module level import not at top of file
# "E501", # Line too long (<LENGTH> > 100 characters)
# "E701", # Multiple statements on one line (colon)
# "E702", # Multiple statements on one line (semicolon)
# "E703", # Statement ends with an unnecessary semicolon
# "E704", # Multiple statements on one line (def)
# "E711", # Comparison to `None` should be `cond is not None`
# "E712", # Comparison to `<BOOL>` should be `cond is <BOOL>`
# "E713", # Test for membership should be `not in`
# "E714", # Test for object identity should be `is not`
# "E721", # Do not compare types, use `isinstance()`
# "E722", # Do not use bare `except`
# "E731", # Do not assign a `lambda` expression, use a `def`
# "E741", # Ambiguous variable name: `<VARIABLE>`
# "E743", # Ambiguous function name: `<FUNCTION>`
# "EM101", # Exception must not use a string literal, assign to variable first
# "EM102", # Exception must not use an f-string literal, assign to variable first
# "N803", # Argument name `R` should be lowercase
# "N806", # Variable `D` in function should be lowercase
# "F401", # `<TYPE>` imported but unused
# "F403", # `from <MODULE> import *` used; unable to detect undefined names
# "F405", # `<TYPE>` may be undefined, or defined from star imports: `<MODULE>`
# "F523", # `.format` call has unused arguments at position(s): <INDEX>
# "F601", # Dictionary key literal `'<KEY>'` repeated
# "F811", # Redefinition of unused `<VARIABLE>` from line <LINE>
# "F821", # Undefined name `VARIABLE`
# "F823", # Local variable `VARIABLE` referenced before assignment
# "F841", # Local variable `VARIABLE` is assigned to but never used
# "FBT001", # Boolean positional arg in function definition (TODO!)
# "FBT002", # Boolean default value in function definition (TODO!)
# "FBT003", # Boolean positional value in function call
# "I001",
# "I101",
# "I201",
# "I202",
# "INP001", # File `tools/clear-prev-dist-info.py` is part of an implicit namespace package.
"ISC001", # may cause conflicts when used with the ruff formatter
# ignore some questionable pandas-vet warnings
# "PD005", # use operator instead of method
# "PD008", # We use at() to access single values
# "PD009", # And we use iat()
"PLE1205", # logging-too-many-args - we use loguru with '{' style of placeholders
# "PLR0912", # Too many branches (15 > 12)
# "PLR0913", # Too many arguments to function call (6 > 5)
# "PLR0915", # Too many statements (65 > 50)
"PLR2004", # magic number - don't want declare 0.0 as constant
# "PLR5501", # Consider using `elif` instead of `else` then `if` to remove one indentation level
"PT019", # Fixture `_bin` without value is injected as parameter (false positive?)
# "S101", # Use of `assert` detected
# "S301", # `pickle` and modules that wrap... - TODO - use sql instead of pickle
# "SLF001", # Private member accessed: `_geometry_spec`
"TD", # TODO @dvp: revise TODOs and move actual to issues
"FIX", # -- the same as above
# "TCH001", # Move application import `mckit.utils.named` into a type-checking block
# "TRY003", # Avoid specifying long messages outside the exception class
# "W503", # Line break before binary operator: for compatibility with black settings
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402"]
"src/xpypact/fluxes.py" = ["F811"]
"benchmarks/*" = ["S101"]
"noxfile.py" = ["ANN"]
"tests/*" = ["ANN", "D100", "D101", "D102", "D103", "D104", "PLR2004", "S101"]
"src/xpypact/inventory.py" = ["F811"]
"src/xpypact/data_arrays.py" = ["ANN401", "PD011"]
"src/xpypact/utils/resource.py" = ["ANN202"]
"tools/*" = ["T201", "INP001", "S603", "S607"]
"docs/source/conf.py" = ["A001", "D100", "ERA001", "INP001"]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 15
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true # skip return type for __init__() methods
[tool.ruff.lint.flake8-pytest-style]
parametrize-names-type = "csv"
[tool.ruff.lint.flake8-type-checking]
strict = true
[tool.ruff.lint.isort]
known-first-party = ["src"]
known-third-party = ["mpl_toolkits", "matplotlib", "numpy", "scipy", "loguru", "tqdm", "dotenv"]
default-section = "third-party"
lines-between-types = 1
required-imports = ["from __future__ import annotations"]
case-sensitive = true
section-order = [
"future",
"typing",
"standard-library",
"third-party",
"first-party",
"local-folder",
"testing"
]
[tool.ruff.lint.isort.sections]
"typing" = ["typing", "typing_extension"]
"testing" = ["tests"]
[tool.ruff.lint.pydocstyle]
convention = "google" # Use Google-style docstrings.
[tool.ruff.format]
docstring-code-format = true
[tool.sqlfluff.core]
dialect = "duckdb"
sql_file_exts = ".sql,.dml,.ddl"
max_line_length = 120
[tool.sqlfluff.indentation]
# While implicit indents are not enabled by default. Many of the
# SQLFluff maintainers do use them in their projects.
allow_implicit_indents = true
# The default configuration for aliasing rules is "consistent"
# which will auto-detect the setting from the rest of the file. This
# is less desirable in a new project and you may find this (slightly
# more strict) setting more useful.
[tool.sqlfluff.rules.aliasing.table]
aliasing = "explicit"
[tool.sqlfluff.rules.aliasing.column]
aliasing = "explicit"
[tool.sqlfluff.rules.aliasing.length]
min_alias_length = 3
# The default configuration for capitalisation rules is "consistent"
# which will auto-detect the setting from the rest of the file. This
# is less desirable in a new project and you may find this (slightly
# more strict) setting more useful.
# Typically, we find users rely on syntax highlighting rather than
# capitalisation to distinguish between keywords and identifiers.
# Clearly, if your organisation has already settled on uppercase
# formatting for any of these syntax elements then set them to "upper".
# See https://stackoverflow.com/questions/608196/why-should-i-capitalize-my-sql-keywords-is-there-a-good-reason
[tool.sqlfluff.rules.capitalisation.keywords]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.identifiers]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.functions]
extended_capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.literals]
capitalisation_policy = "lower"
[tool.sqlfluff.rules.capitalisation.types]
extended_capitalisation_policy = "lower"
[tool.jupytext]
# https://jupytext.readthedocs.io/en/latest/config.html
# Pair ipynb notebooks to py:percent text notebooks
formats = "ipynb,md,py:percent"