-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
243 lines (206 loc) · 9.16 KB
/
Copy pathpyproject.toml
File metadata and controls
243 lines (206 loc) · 9.16 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
###############################
# Configuration for the project
###############################
[project]
name = 'easyscience'
dynamic = ['version'] # Use versioningit to manage the version
description = 'Core building blocks for EasyScience'
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',
'Programming Language :: Python :: 3.13',
]
requires-python = '>=3.11'
dependencies = [
'asteval', # Safely evaluate Python expressions from strings
'lmfit', # Non-linear least squares fitting
'bumps', # Bayesian uncertainty estimation
'dfo-ls', # Derivative-free optimization
'uncertainties', # Propagation of uncertainties in calculations
'numpy', # Numerical computing
'scipp', # Handling and analysis of scientific data
'pooch', # Data downloader
'matplotlib', # 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
]
[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
'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
'docformatter', # Code formatter for docstrings
'interrogate', # Check for missing docstrings
'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]
Documentation = 'https://easyscience.github.io/core'
'Release Notes' = 'https://github.com/easyscience/core/releases'
'Source Code' = 'https://github.com/easyscience/core'
'Issue Tracker' = 'https://github.com/easyscience/core/issues'
############################
# Build system configuration
############################
# Build system 'hatch' -- Python project manager
# https://hatch.pypa.io/
# Versioning system 'versioningit' -- Versioning from git tags
# https://versioningit.readthedocs.io/
[build-system]
build-backend = 'hatchling.build'
requires = ['hatchling', 'versioningit']
#############################
# Configuration for hatchling
#############################
[tool.hatch.build.targets.wheel]
packages = ['src/easyscience']
exclude = ['src/easyscience/legacy']
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.version]
source = 'versioningit' # Use versioningit to manage the version
################################
# Configuration for versioningit
################################
# 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' -- Check for missing docstrings
# 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
#######################################
[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
##########################
[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 = ['legacy', 'tests']
indent-width = 4
line-length = 99
preview = true # Enable new rules that are not yet stable, like DOC
[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)
# https://docs.astral.sh/ruff/rules/
[tool.ruff.lint]
select = [
# 'E', # General PEP 8 style errors
'E9', # Runtime errors (e.g., syntax errors, undefined names)
# 'F', # Pyflakes-specific checks (e.g., unused variables, imports)
'F63', # Issues related to invalid escape sequences in strings
'F7', # Type-related errors (e.g., mismatched argument types, unsupported operations)
'F82', # Import-related errors (e.g., unresolved imports, reimported modules)
'I', # Import sorting issues (e.g., unsorted imports)
# 'S', # Security-related issues (e.g., use of insecure functions or libraries)
# 'W', # General PEP 8 warnings (e.g., lines too long, trailing whitespace)
]
[tool.ruff.lint.per-file-ignores]
'tests/**/*.py' = ['S101'] # Allow assert statements in tests
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = 'all'
[tool.ruff.lint.isort]
force-single-line = true
[tool.ruff.lint.mccabe]
max-complexity = 10 # default is 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
[tool.ruff.lint.pydocstyle]
convention = 'google'
################################
# 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