-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
336 lines (289 loc) · 13.4 KB
/
pyproject.toml
File metadata and controls
336 lines (289 loc) · 13.4 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
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
###############################
# Configuration for the project
###############################
[project]
name = 'easydynamics'
dynamic = ['version'] # Use versioningit to manage the version
description = 'QENS data analysis'
authors = [{ name = 'EasyScience contributors' }]
readme = 'README.md'
license = 'BSD-3-Clause'
license-files = ['LICENSE']
classifiers = [
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
requires-python = '>=3.11'
dependencies = [
'easyscience', # The base library of the EasyScience framework
'pooch', # Data downloader
'darkdetect', # Detecting dark mode (system-level)
'plopp', # Plotting library
'jupyterlab', # Jupyter notebooks
'pixi-kernel', # Pixi Jupyter kernel
'ipykernel', # Jupyter kernel (required for running notebooks)
'ipywidgets', # Widgets (needed for interactive matplotlib backends)
'ipympl', # Matplotlib Jupyter widget backend (%matplotlib widget)
'IPython', # Interactive Python shell
'sympy', # Symbolic mathematics (used for expression components)
]
[project.optional-dependencies]
dev = [
'GitPython', # Interact with Git repositories
'build', # Building the package
'pre-commit', # Pre-commit hooks
'jinja2', # Templating
'nbmake', # Building notebooks
'nbstripout', # Strip output from notebooks
'nbqa', # Linting and formatting notebooks
'pytest', # Testing
'pytest-cov', # Test coverage
'pytest-xdist', # Enable parallel testing
'pytest-forked', # Isolate tests in subprocesses
'ruff', # Linting and formatting code
'radon', # Code complexity and maintainability
'validate-pyproject[all]', # Validate pyproject.toml
'versioningit', # Automatic versioning from git tags
'jupytext', # Jupyter notebook text format support
'jupyterquiz', # Quizzes in Jupyter notebooks
'pydoclint', # Docstring linter
'docformatter', # Docstring formatter
'interrogate', # Docstring coverage checker
'copier', # Template management
'mike', # MkDocs: Versioned documentation support
'mkdocs', # Static site generator
'mkdocs-material', # Documentation framework on top of MkDocs
'mkdocs-autorefs', # MkDocs: Auto-references support
'mkdocs-jupyter', # MkDocs: Jupyter notebook support
'mkdocs-plugin-inline-svg', # MkDocs: Inline SVG support
'mkdocs-markdownextradata-plugin', # MkDocs: Markdown extra data support, such as global variables
'mkdocstrings-python', # MkDocs: Python docstring support
'pyyaml', # YAML parser
'spdx-headers', # SPDX license header validation
]
[project.urls]
Homepage = 'https://easyscience.github.io/dynamics-lib'
Documentation = 'https://easyscience.github.io/dynamics-lib'
'Release Notes' = 'https://github.com/easyscience/dynamics-lib/releases'
'Source Code' = 'https://github.com/easyscience/dynamics-lib'
'Issue Tracker' = 'https://github.com/easyscience/dynamics-lib/issues'
############################
# Build system configuration
############################
[build-system]
build-backend = 'hatchling.build'
requires = ['hatchling', 'versioningit']
#############################
# Configuration for hatchling
#############################
# 'hatch' -- Build system for Python
# https://hatch.pypa.io/
[tool.hatch.build.targets.wheel]
packages = ['src/easydynamics']
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.version]
source = 'versioningit' # Use versioningit to manage the version
################################
# Configuration for versioningit
################################
# 'versioningit' -- Versioning from git tags
# https://versioningit.readthedocs.io/
# Versioningit generates versions from git tags, so we don't need to
# either specify them statically in pyproject.toml or save them in the
# source code. Do not use {distance} in the version format, as it
# forces a version bump for every commit, which triggers unnecessary
# pixi.lock update without any changes to the source code.
[tool.versioningit.format]
distance = '{base_version}+dev{distance}' # example: 1.2.3.post4+dev3
dirty = '{base_version}+dirty{distance}' # example: 0.5.8+dirty3
distance-dirty = '{base_version}+devdirty{distance}' # example: 0.5.8+devdirty3
# Configure how versioningit detects versions from Git
# - 'match' ensures it only considers tags starting with 'v'
# - 'default-tag' is used as a fallback when no matching tag is found
[tool.versioningit.vcs]
method = 'git'
match = ['v*']
default-tag = 'v999.0.0'
################################
# Configuration for interrogate
################################
# 'interrogate' -- Docstring coverage checker
# https://interrogate.readthedocs.io/en/latest/
[tool.interrogate]
fail-under = 0 # Minimum docstring coverage percentage to pass
verbose = 1
#exclude = ['src/**/__init__.py']
#######################################
# Configuration for coverage/pytest-cov
#######################################
# 'coverage' -- Code coverage measurement tool
# https://coverage.readthedocs.io/en/latest/
[tool.coverage.run]
branch = true # Measure branch coverage as well
source = ['src'] # Limit coverage to the source code directory
[tool.coverage.report]
show_missing = true # Show missing lines
skip_covered = false # Skip files with 100% coverage in the report
fail_under = 0 # Minimum coverage percentage to pass
##########################
# Configuration for pytest
##########################
# 'pytest' -- Testing framework
# https://docs.pytest.org/en/stable/
[tool.pytest.ini_options]
addopts = '--import-mode=importlib'
markers = ['fast: mark test as fast (should be run on every push)']
testpaths = ['tests']
########################
# Configuration for ruff
########################
# 'ruff' -- Python linter and code formatter
# https://docs.astral.sh/ruff/rules/
[tool.ruff]
exclude = ['tmp']
indent-width = 4
line-length = 99
preview = true # Enable new rules that are not yet stable, like DOC
# Formatting options for Ruff
[tool.ruff.format]
docstring-code-format = true # Whether to format code snippets in docstrings
docstring-code-line-length = 72 # Line length for code snippets in docstrings
indent-style = 'space' # PEP 8 recommends using spaces over tabs
line-ending = 'lf' # Line endings will be converted to \n
quote-style = 'single' # But double quotes in docstrings (PEP 8, PEP 257)
# Linting rules to use with Ruff
[tool.ruff.lint]
select = [
# Various rules
#'C90', # https://docs.astral.sh/ruff/rules/#mccabe-c90
'F', # https://docs.astral.sh/ruff/rules/#pyflakes-f
#'FLY', # https://docs.astral.sh/ruff/rules/#flynt-fly
#'FURB', # https://docs.astral.sh/ruff/rules/#refurb-furb
'I', # https://docs.astral.sh/ruff/rules/#isort-i
#'N', # https://docs.astral.sh/ruff/rules/#pep8-naming-n
#'NPY', # https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy
#'PGH', # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
#'PERF', # https://docs.astral.sh/ruff/rules/#perflint-perf
#'RUF', # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
#'TRY', # https://docs.astral.sh/ruff/rules/#tryceratops-try
'UP', # https://docs.astral.sh/ruff/rules/#pyupgrade-up
# pycodestyle (E, W) rules
'E', # https://docs.astral.sh/ruff/rules/#error-e
'W', # https://docs.astral.sh/ruff/rules/#warning-w
# Pylint (PL) rules
#'PLC', # https://docs.astral.sh/ruff/rules/#convention-plc
#'PLE', # https://docs.astral.sh/ruff/rules/#error-ple
#'PLR', # https://docs.astral.sh/ruff/rules/#refactor-plr
#'PLW', # https://docs.astral.sh/ruff/rules/#warning-plw
# flake8 rules
#'A', # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
'ANN', # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
'ARG', # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
#'ASYNC', # https://docs.astral.sh/ruff/rules/#flake8-async-async
'B', # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
#'BLE', # https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble
'C4', # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
#'COM', # https://docs.astral.sh/ruff/rules/#flake8-commas-com
#'DTZ', # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
#'EM', # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
#'FA', # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa
#'FBT', # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
#'FIX', # https://docs.astral.sh/ruff/rules/#flake8-fixme-fix
#'G', # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
#'ICN', # https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
#'INP', # https://docs.astral.sh/ruff/rules/#flake8-no-pep420-inp
#'ISC', # https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
#'LOG', # https://docs.astral.sh/ruff/rules/#flake8-logging-log
#'PIE', # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
#'PT', # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
'PTH', # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
#'PYI', # https://docs.astral.sh/ruff/rules/#flake8-pyi-pyi
'RET', # https://docs.astral.sh/ruff/rules/#flake8-return-ret
#'RSE', # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
'S', # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
'SIM', # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
#'SLF', # https://docs.astral.sh/ruff/rules/#flake8-self-slf
#'SLOT', # https://docs.astral.sh/ruff/rules/#flake8-slots-slot
#'T20', # https://docs.astral.sh/ruff/rules/#flake8-print-t20
#'TC', # https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
#'TD', # https://docs.astral.sh/ruff/rules/#flake8-todos-td
#'TID', # https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
]
# Exceptions to the linting rules
# Ignore specific rules globally
ignore = [
'COM812', # https://docs.astral.sh/ruff/rules/missing-trailing-comma/
# The following covered by [tool.pydoclint] section below
'D', # https://docs.astral.sh/ruff/rules/#pydocstyle-d
'DOC', # https://docs.astral.sh/ruff/rules/#pydoclint-doc
]
# Ignore specific rules in certain files or directories
[tool.ruff.lint.per-file-ignores]
'tests/**' = [
'ANN', # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
'DOC', # https://docs.astral.sh/ruff/rules/#pydoclint-doc
'INP001', # https://docs.astral.sh/ruff/rules/implicit-namespace-package/
'S101', # https://docs.astral.sh/ruff/rules/assert/
]
'docs/**' = [
'INP001', # https://docs.astral.sh/ruff/rules/implicit-namespace-package/
'T201', # https://docs.astral.sh/ruff/rules/print/
]
# Specific options for certain rules
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports
ban-relative-imports = 'all'
[tool.ruff.lint.isort]
# Forces all from imports to appear on their own line
force-single-line = true
[tool.ruff.lint.mccabe]
# Cyclomatic complexity threshold (default is 10)
max-complexity = 10
[tool.ruff.lint.pycodestyle]
# PEP 8 line length guidance:
# https://peps.python.org/pep-0008/#maximum-line-length
# Use 99 characters as the project-wide maximum for regular code lines.
max-line-length = 99
# allow longer lines so that parameter declarations such as
# `name (Type | Type | None):` remain on a single line. Splitting these
# lines can prevent tools such as MkDocs and IDEs from correctly
# parsing and rendering parameter documentation.
# The descriptive text itself is wrapped more strictly by
# `docformatter` (see the configuration in [tool.docformatter] below)
# whenever it is treated as normal paragraph text.
# The line length for code snippets in docstrings is also more strict,
# as defined in the [tool.ruff.format] section above.
max-doc-length = 99
#############################
# Configuration for pydoclint
#############################
# 'pydoclint' -- Docstring linter, a faster alternative to
# 'darglint' or 'darglint2'.
# https://pypi.org/project/pydoclint/
# This is a more advanced docstring linter compared to Ruff's built-in
# docstring check rules D or DOC. For example, among many other things,
# it can check that arguments in the docstring, which are used by MkDocs
# and IDEs to render parameter documentation, remain synchronized with
# the parameter declarations in the code (in function's signature).
[tool.pydoclint]
style = "google"
check-style-mismatch = true
check-arg-defaults = true
allow-init-docstring = true
################################
# Configuration for docformatter
################################
# 'docformatter' -- Code formatter for docstrings
# https://docformatter.readthedocs.io/en/latest/
[tool.docformatter]
recursive = true
wrap-summaries = 72
wrap-descriptions = 72
close-quotes-on-newline = true