forked from rorni/mckit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
580 lines (508 loc) · 15.4 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
[build-system]
requires = [
"poetry-core >= 2.0.0, <3.0.0",
"cmake >= 3.26.3",
"ninja; platform_system!='Windows'",
"setuptools >= 67.8.0",
"numpy >= 2.1.3",
"mkl-devel >= 2025.0.1",
"intel-cmplr-lib-ur == 2025.0.4", # next version 2025.0.5 is for windows only TODO check for updates
"scikit-build"
]
build-backend = "poetry.core.masonry.api"
[project]
name = "mckit"
dynamic = ["version", "requires-python"]
description = "Tools to process MCNP models and results"
license = { text = "GPL3" }
readme = "README.rst"
authors = [
{ name = "rrn" }
]
maintainers = [
{ name = "dvp2015", email = "[email protected]" }
]
keywords = ["mckit", "MCNP"]
# Select from PyPI trove classifiers: https://pypi.org/classifiers/
# poetry (2.0.0) doesn't pass dynamic classifieres to build.py, so, we use static
# about dynamic classifiers in poetry: https://python-poetry.org/docs/pyproject/#classifiers-1
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: Other/Proprietary License",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: C",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"attrs (>=21.2.0)",
"click (>=8.0.1)",
"loguru (>=0.6.0)",
"intel-cmplr-lib-ur == 2025.0.4", # next version 2025.0.5 is for windows only TODO check for updates
"mkl-devel (>=2025.0.1)",
"numpy (>=2.1.3)",
"ply (>=3.11)",
"python-dotenv (>=0.20.0)",
"scipy (>=1.14.0)",
"sly (>=0.4)",
"tomli-w (>=1.0.0)",
"tqdm (>=4.55.1)",
"typer[all] >=0.9.0",
'tomli >=2.0.1; python_version < "3.11"'
]
[project.urls]
homepage = "https://github.com/MC-kit/mckit"
repository = "https://github.com/MC-kit/mckit"
documentation = "https://mckit.readthedocs.io"
"Repository" = "https://github.com/MC-kit/mckit"
"Bug Tracker" = "https://github.com/MC-kit/mckit/issues"
[project.scripts]
mckit = "mckit.cli.runner:mckit"
[tool.poetry]
version = "0.8.4"
packages = [
{ include = "mckit", from = "src" },
]
include = [
{ path = "noxfile.py", format = "sdist" },
{ path = "tests", format = "sdist" },
{ path = "docs", format = "sdist" },
{ path = "build.py", format = "sdist" },
{ path = "create_mkl_symlinks.py", format = "sdist" },
# C extensions must be included in the wheel distribution.
{ path = "src/mckit/**/*.pyd", format = "wheel" },
{ path = "src/mckit/**/*.so", format = "wheel" },
]
exclude = [
{ path = "docs/build" },
{ path = "setup.py" },
]
[tool.poetry.build]
script = "build.py"
generate-setup-file = true
#[tool.skikit-build]
#cmake.verbose = true
[tool.poetry.dependencies]
python = ">=3.10,<3.14"
[tool.poetry.group.dev.dependencies]
Pygments = ">=2.10.0"
nox = ">=2022.1.7"
scikit-build = ">=0.17.6"
[tool.poetry.group.pre_commit.dependencies]
pre-commit = ">=2.15.0"
rstcheck = ">=6.1.2"
pydocstringformatter = ">=0.7.3"
pyupgrade = ">=3.15.0"
[tool.poetry.group.test.dependencies]
pytest = ">=7.1"
pytest-benchmark = ">=4.0.0"
# 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" }
[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"
types-tqdm = ">=4.66.0.2"
[tool.poetry.group.docs.dependencies]
sphinx = ">=6.1.3"
sphinx-autodoc-typehints = ">=1.19.5"
sphinx-click = ">=4.4.0"
[tool.poetry.group.docs_auto.dependencies]
sphinx-autobuild = ">=2021.3.14"
[tool.poetry.group.ruff.dependencies]
ruff = ">=0.0.259"
[tool.poetry.group.analyze.dependencies]
jupyterlab = ">=4.2.5"
jupytext = ">=1.16.4"
[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
--benchmark-disable
--benchmark-storage=.cache/benchmarks
--benchmark-autosave
--benchmark-compare
--benchmark-group-by=name,fullname
'''
doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ALLOW_UNICODE ALLOW_BYTES NUMBER"
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 = 90 # TODO dvp: increase limit to 100 with code maturing
omit = ["*_tab.py", "**/__init__.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 # TODO dvp: uncomment this to get strict control
follow_imports = "silent"
# namespace_packages = true
warn_return_any = true
warn_unused_configs = true
show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
disable_error_code = ["annotation-unchecked"]
show_error_context = true
error_summary = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
files = "src/**/*.py"
exclude = '''
(?x)(
parser\.py$ # mypy doesn't parser code
| _tab\.py$ # ...
| lexer\.py$ # ...
)
'''
plugins = ["numpy.typing.mypy_plugin"]
[[tool.mypy.overrides]]
module = [
"IPython.core.magic",
"IPython.core.magic_arguments",
"click",
"click.testing",
"loguru",
"mckit.*", # TODO (dvp, style): make everything typed including extension 'geometry'
"multipledispatch",
"nox",
"numpy.testing",
"pandas",
"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",
".direnv",
".cache",
".eggs",
".git",
".git-rewrite",
".mypy_cache",
".nox",
".ruff_cache",
".venv",
"__pycache__",
"_build",
"adhoc",
"build",
"dist",
"docs/source/conf.py",
"extern",
"notebooks",
"venv",
"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
"AIR", # Airflow https://airflow.apache.org/docs/apache-airflow/stable/index.html
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"C90", # mccabe
"COM", # flake8-commas
# "CPY", # flake8-copyright
"D", # pydocstyle
"DJ", # flake8-django
# "DTZ", # flake8-datetimez
"E", # pycodestyle
# "EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
# "FAST", # FastAPI
# "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
]
# 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
"ANN202", # ANN202 Missing return type annotation for protected function: ... dispatching
"ANN204", # ANN204 Missing return type annotation for special method
"ARG001", # Unused function argument: `expected`
"C901", # too complex - ...
"COM812", # [*] Trailing comma missing
"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__
"E402", # Module level import not at top of file
"E501", # Line too long (<LENGTH> > 100 characters)
"N803", # Argument name `R` should be lowercase
"N806", # Variable `D` in function should be lowercase
"ISC001", # may cause conflicts when used with the ruff formatter
"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 - TODO - replace assert statements with exception raise
"TRY003", # Avoid specifying long messages outside the exception class
]
[tool.ruff.lint.per-file-ignores]
"benchmarks/*" = ["S101"]
"tests/*" = ["ANN", "D100", "D101", "D102", "D103", "D104", "PLR2004", "S101"]
"src/mckit/cli/*" = [
"PLE1205", # Too many arguments for `logging` format string - we use loguru in CLI modules
]
"src/mckit/parser/*" = [
"A003",
"D",
"F811",
"F821",
"N802",
"N816", # Variable `t_ANY_ignore` in global scope should not be mixedCase
"T201", # print found
]
"tests/parser/*" = [
"A003",
"D",
"F811",
"F821",
"N802",
"N816", # Variable `t_ANY_ignore` in global scope should not be mixedCase
"T201", # print found
]
"tools/*" = ["T201", "INP001", "S603", "S607"]
".unclassified/*" = ["INP001"]
"tutorial/*" = ["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
# 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`.
[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.jupytext]
# https://jupytext.readthedocs.io/en/latest/config.html
# Pair ipynb notebooks to py:percent text notebooks
formats = "ipynb,md,py:percent"
[tool.creosote]
paths = ["src", "adhoc"]
deps-file = "pyproject.toml"
sections = ["project.dependencies"]
exclude-deps = [
"intel-cmplr-lib-ur",
"mkl-devel",
"python-dotenv",
"scipy",
"tomli",
"tqdm",
"typer",
]