-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpyproject.toml
More file actions
439 lines (406 loc) · 14 KB
/
pyproject.toml
File metadata and controls
439 lines (406 loc) · 14 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
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
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.9.0"]
[tool.coverage.paths]
source = [
"src/tm_data_types",
".tox/**/site-packages/tm_data_types",
]
[tool.coverage.report]
exclude_lines = [
"if TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError",
]
fail_under = 80 # TODO: set to 100 after reaching 100% coverage
show_missing = true
skip_empty = true
[tool.coverage.run]
branch = true
cover_pylib = false
source = ["tm_data_types"]
[tool.docformatter]
close-quotes-on-newline = true
in-place = true
recursive = true
wrap-descriptions = 100
wrap-summaries = 0
[tool.poetry]
authors = ["Tektronix <opensource@tektronix.com>"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9", # manually add this classifier since Poetry won't add it automatically due to the mimimum Python version being 3.9.2 # TODO: Drop Python 3.9: Remove this classifier
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
"Topic :: Scientific/Engineering",
"Topic :: System :: Hardware :: Hardware Drivers",
]
description = "Read and write common Test & Measurement data types."
documentation = "https://tm-data-types.readthedocs.io"
homepage = "https://pypi.org/project/tm_data_types/"
keywords = [
"Tektronix",
"Test & Measurement",
]
license = "Apache-2.0"
maintainers = ["Tektronix <opensource@tektronix.com>"]
name = "tm_data_types"
readme = "README.md"
repository = "https://github.com/tektronix/tm_data_types"
version = "0.3.0"
[tool.poetry.dependencies]
bidict = "^0.23.1"
numba = [
{python = ">=3.9,<3.13", version = "^0.60.0"},
{python = ">=3.13", version = "^0.61.0"},
]
numpy = [
# This is required to be duplicated in the "main" and "dev" groups to ensure that the correct version is used in both cases
{python = ">=3.9,<3.13", version = "^1.24"},
{python = ">=3.13", version = "^2.1"},
]
pydantic = "^2.7.4"
python = ">=3.9.2,<3.14" # This is the main Python version requirement
python-dateutil = "^2.8.2"
scipy = [
{python = ">=3.9,<3.13", version = "^1.9"},
{python = ">=3.13", version = "^1.14"},
]
[tool.poetry.group.dev.dependencies]
docutils-stubs = "^0.0.22"
matplotlib = "^3.8"
nodeenv = "^1.9.1"
numpy = [
# This is required to be duplicated in the "main" and "dev" groups to ensure that the correct version is used in both cases
{python = ">=3.9,<3.13", version = "^1.24"},
{python = ">=3.13", version = "^2.1"},
]
pip = "^25.0"
poetry = "^1.8.0"
poetry-audit-plugin = "^0.4.0"
poetry-plugin-export = "^1.7.1"
poetry-pre-commit-plugin = "^0.2.2"
pre-commit = "^4.2"
pylint = "3.3.9"
pyright = {extras = ["nodejs"], version = "1.1.407"}
pyroma = "^5.0"
tox = "^4.0"
tox-gh-actions = "^3.1.0"
twine = "^6.0.1"
types-python-dateutil = "^2.9"
types-pyyaml = "^6.0"
types-requests = "^2.31"
wheel = "^0.45.0"
[tool.poetry.group.docs.dependencies]
black = "^25.1.0"
codespell = "^2.2.6"
griffe = "^1.1.0"
mkdocs = "^1.6.0"
mkdocs-ezglossary-plugin = "^2.0.0"
mkdocs-gen-files = "^0.6.0"
mkdocs-include-markdown-plugin = "^7.1.5"
mkdocs-literate-nav = "^0.6.1"
mkdocs-macros-plugin = "^1.0.5"
mkdocs-mermaid2-plugin = "^1.1.1"
mkdocs-section-index = "^0.3.9"
mkdocs-spellcheck = "^1.1.0"
mkdocstrings = "^0.30.0"
mkdocstrings-python = "^1.10.2"
nodeenv = "^1.9.1"
packaging = "^25.0"
pygments = "^2.17.2"
pymdown-extensions = "^10.8.1"
requests = "^2.31.0"
symspellpy = "^6.7.7"
tomli = "^2.0.1"
[tool.poetry.group.tests.dependencies]
coverage = "^7.5.0"
linkchecker = "^10.0.0"
pytest = "^8.2.0"
pytest-cov = "^7.0.0"
pytest-depends = "^1.0.1"
pytest-env = "^1.1.3"
pytest-github-report = "^0.0.1"
pytest-html = "^4.1.1"
pytest-order = "^1.2.1"
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/tektronix/tm_data_types/issues"
"Changelog" = "https://github.com/tektronix/tm_data_types/blob/main/CHANGELOG.md"
[tool.pylint.basic]
good-names = ["_"]
[tool.pylint.main]
fail-under = 10.0
ignore-patterns = [
"^\\.#",
"^\\..*_cache",
"^\\.docs.*",
"^\\.env.*",
"^\\.idea",
"^\\.results.*",
"^\\.tox",
"^\\.venv.*",
"^\\.vscode",
"^temp_.*\\..*",
]
jobs = 0
load-plugins = """
pylint.extensions.check_elif,
pylint.extensions.code_style,
pylint.extensions.comparison_placement,
pylint.extensions.consider_refactoring_into_while_condition,
pylint.extensions.dict_init_mutate,
pylint.extensions.docparams,
pylint.extensions.docstyle,
pylint.extensions.dunder,
pylint.extensions.eq_without_hash,
pylint.extensions.for_any_all,
pylint.extensions.no_self_use,
pylint.extensions.overlapping_exceptions,
pylint.extensions.private_import,
pylint.extensions.set_membership,
pylint.extensions.typing,
pylint.extensions.while_used
"""
py-version = "3.9"
recursive = true
[tool.pylint."messages control"]
enable = ["all"]
disable = [
"broad-exception-caught", # caught by ruff
"deprecated-typing-alias", # caught by ruff
"duplicate-code",
"fixme", # caught by ruff
"global-statement", # caught by ruff
"invalid-name", # caught by ruff
"line-too-long", # caught by ruff
"locally-disabled", # allowed
"missing-class-docstring", # caught by ruff
"missing-module-docstring", # caught by ruff
"no-member", # caught by pyright
"protected-access", # caught by ruff
"raise-missing-from", # caught by ruff
"redefined-builtin", # caught by ruff
"suppressed-message", # allowed
"too-many-arguments", # caught by ruff
"too-many-branches", # caught by ruff
"too-many-lines", # not necessary to check for
"too-many-positional-arguments", # caught by ruff
"too-many-return-statements", # caught by ruff
"too-many-statements", # caught by ruff
"unnecessary-default-type-args", # not necessary to check for
"unused-argument", # caught by ruff
"unused-import", # caught by ruff
"use-implicit-booleaness-not-comparison-to-string", # caught by ruff
"while-used", # using while loops in example scripts
"wrong-import-order", # caught by ruff
]
[tool.pylint.reports]
# Python expression which should return a score less than or equal to 10. You
# have access to the variables 'fatal', 'error', 'warning', 'refactor',
# 'convention', and 'info' which contain the number of messages in each category,
# as well as 'statement' which is the total number of statements analyzed. This
# score is used by the global evaluation report (RP0004).
evaluation = "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention + info) / statement) * 10))"
score = true
output-format = "text" # colorized could be another option
[tool.pyright]
ignore = [
"**/output_*/**",
"site/**",
"temp_*.py",
]
pythonPlatform = "All"
pythonVersion = "3.9"
reportCallInDefaultInitializer = "error"
reportImplicitOverride = "error"
reportImplicitStringConcatenation = "error"
reportImportCycles = "none" # other analysis tools catch these more effectively
reportMissingSuperCall = "none" # this can be ignored since this would break unit tests if handled incorrectly
reportPropertyTypeMismatch = "error"
reportShadowedImports = "error"
reportUninitializedInstanceVariable = "error"
reportUnnecessaryTypeIgnoreComment = "error"
reportUnusedCallResult = "none" # this can be ignored since this would break unit tests if handled incorrectly
strict = ["**"]
stubPath = "src"
typeCheckingMode = "strict"
useLibraryCodeForTypes = true
[tool.pytest.ini_options]
addopts = "--order-scope=module --cov-config=pyproject.toml"
doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL"
filterwarnings = []
junit_family = "xunit2"
junit_logging = "all"
markers = [
'docs',
'order',
'slow',
]
xfail_strict = true
[tool.pytest_env]
pytest_report_title = {skip_if_set = true, value = "Test Results"}
[tool.ruff]
line-length = 100
namespace-packages = ["docs/**", "examples/**", "scripts/**", "tests/**"]
output-format = "concise"
src = ["docs", "examples", "scripts", "src", "tests"]
target-version = "py39" # always generate Python 3.9 compatible code
[tool.ruff.lint]
allowed-confusables = []
fixable = ["ALL"]
flake8-pytest-style = {mark-parentheses = false}
flake8-quotes = {docstring-quotes = "double"}
ignore = [
"ANN", # flake8-annotations # TODO: enable this
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in *args and **kwargs
"COM812", # Trailing comma missing (handled by formatter)
"EM101", # Exception must not use a string literal, assign to variable first # TODO: enable this
"EM102", # Exception must not use an f-string literal, assign to variable first (covered by TRY003)
"FA100", # Missing `from __future__ import annotations`, but uses ... # TODO: enable this
"FBT", # flake8-boolean-trap # TODO: enable this
"FIX002", # Line contains TO DO
"ISC001", # single-line-implicit-string-concatenation (handled by formatter)
"PTH", # flake8-use-pathlib # TODO: enable this
"RET504", # Unnecessary assignment to ... before return statement # TODO: enable this
"TD002", # Missing author in TO DO
"TD003", # Missing issue link on the line following this TO DO
"TRY003", # Avoid specifying long messages outside the exception class # TODO: enable this
"UP006", # Use `type` instead of `Type` for type annotation # TODO: Drop Python 3.9: enable this check
"UP007", # Use `Literal` instead of `typing.Literal` for type annotation # TODO: Drop Python 3.9: enable this check
"UP024", # Replace aliased errors with `OSError`
"UP035", # Use `X | Y` for type annotations # TODO: Drop Python 3.9: enable this check
"UP036", # Use `X | Y | None` for type annotations # TODO: Drop Python 3.9: enable this check
"UP037", # Remove quotes from type annotation # TODO: Drop Python 3.9: enable this check
"UP045", # Use `X | None` for type annotations # TODO: Drop Python 3.9: enable this check
]
pydocstyle = {convention = "google"}
pylint = {max-args = 7}
# https://beta.ruff.rs/docs/rules/
select = [
"ALL",
]
task-tags = ["FIXME", "FUTURE", "RELIC", "TODO"]
[tool.ruff.lint.isort]
force-sort-within-sections = false
known-first-party = [
"conftest",
"tm_data_types",
]
lines-between-types = 1
order-by-type = false
[tool.ruff.lint.per-file-ignores]
"examples/**" = [
"S101", # Use of assert detected
"T201", # `print` found
]
"tests/**" = [
"PLC1901", # compare-to-empty-string
"PLR2004", # Magic value used in comparison
"S101", # Use of assert detected
"T201", # `print` found
]
[tool.semantic_release]
version_toml = [
"pyproject.toml:tool.poetry.version",
]
[tool.semantic_release.changelog]
exclude_commit_patterns = []
template_dir = "python_semantic_release_templates"
[tool.semantic_release.changelog.environment]
extensions = []
[tool.semantic_release.commit_parser_options]
# These settings allow python-semantic-release to be used without triggering on any commits
allowed_tags = []
minor_tags = []
patch_tags = []
[tool.tomlsort]
all = true
in_place = true
spaces_before_inline_comment = 2
trailing_comma_inline_array = true
overrides."tool.coverage.paths.*".inline_arrays = false
overrides."tool.poetry.*".inline_arrays = false
overrides."tool.pylint.*".table_keys = false
# TODO: enable --doctest-modules line
[tool.tox]
legacy_tox_ini = """
[tox]
requires = tox>4
isolated_build = True
envlist = py39,py310,py311,py312,py313,tests,docs,doctests
skip_missing_interpreters = True
labels =
basic = py39,py310,py311,py312,py313,tests
documentation = docs,doctests
[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
[testenv]
package = wheel
install_command = python -I -m pip install --upgrade --upgrade-strategy=eager {opts} {packages}
deps =
poetry
passenv =
GITHUB_ACTIONS
setenv =
COVERAGE_FILE = .coverage_{envname}
DOC_PYTHON_VERSION = python3.11 # Keep this in sync with .readthedocs.yml and any CI scripts
# Skip pre-commit checks that are not needed
SKIP = file-contents-sorter
commands_pre =
python -m poetry install --no-root --without=main
commands =
!tests: python -c "import shutil; shutil.rmtree('.dist/{envname}', ignore_errors=True)"
!tests: poetry build --output=.dist/{envname}
!tests: twine check --strict .dist/{envname}/*
!tests: pre-commit run --all-files
# !tests: pytest -vv --doctest-modules --doctest-report=ndiff --showlocals --junitxml={tox_root}/.results_{envname}/results_doctests.xml --self-contained-html --html={tox_root}/.results_{envname}/results_doctests.html src
pytest -vv -k "not test_docs" --showlocals --cov --junitxml={tox_root}/.results_{envname}/results.xml --cov-report=term --cov-report=xml:{tox_root}/.coverage_{envname}.xml --cov-report=html:{tox_root}/.results_{envname}/html --self-contained-html --html={tox_root}/.results_{envname}/results.html
[testenv:tests]
basepython = python
deps =
-rtests/requirements.txt
passenv =
pytest_report_title
GITHUB_ACTIONS
setenv =
pytest_github_report = true
pytest_use_blanks = true
GITHUB_STEP_SUMMARY = {tox_root}/.results_{envname}/github_report.md
commands_pre =
[testenv:docs]
basepython = {env:DOC_PYTHON_VERSION}
passenv =
GITHUB_PAT
deps =
-rdocs/requirements.txt
commands_pre =
nodeenv --python-virtualenv --clean-src
python scripts/install_insiders_packages.py
commands =
python -c "import shutil; shutil.rmtree('.results_{envname}', ignore_errors=True)"
mkdocs --verbose build --site-dir .results_{envname}
[testenv:doctests]
basepython = {env:DOC_PYTHON_VERSION}
passenv =
GITHUB_PAT
deps =
-rdocs/requirements.txt
-rtests/requirements.txt
commands_pre =
nodeenv --python-virtualenv --clean-src
python scripts/install_insiders_packages.py
commands =
pytest -v -k "test_docs" --showlocals --junitxml={tox_root}/.results_{envname}/results.xml --self-contained-html --html={tox_root}/.results_{envname}/results.html
[testenv:export-reqs]
commands =
poetry export --without-hashes --without-urls --all-extras --only=docs --output=docs/requirements.txt
poetry export --without-hashes --without-urls --all-extras --only=tests --output=tests/requirements.txt
- pre-commit run -a requirements-txt-fixer
"""