-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpyproject.toml
450 lines (418 loc) · 13.2 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
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.9.0"]
[tool.coverage.report]
exclude_lines = [
"if TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError"
]
fail_under = 74 # TODO: set to 100 after reaching 100% coverage
show_missing = true
skip_empty = true
[tool.coverage.run]
branch = true
cover_pylib = false
omit = [
"_*.py"
]
source = ["tekhsi"]
[tool.docformatter]
close-quotes-on-newline = true
in-place = true
recursive = true
wrap-descriptions = 100
wrap-summaries = 0
[tool.poetry]
authors = ["Tektronix <[email protected]>"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
"Topic :: Scientific/Engineering",
"Topic :: System :: Hardware :: Hardware Drivers"
]
description = "Transfer waveforms from Tektronix Oscilloscopes using the High-Speed Interface."
documentation = "https://TekHSI.readthedocs.io"
homepage = "https://pypi.org/project/TekHSI/"
keywords = [
"Tektronix",
"Test & Measurement"
]
license = "Apache-2.0"
maintainers = ["Tektronix <[email protected]>"]
name = "TekHSI"
readme = "README.md"
repository = "https://github.com/tektronix/TekHSI"
version = "1.0.0"
[tool.poetry.dependencies]
colorlog = "^6.9.0"
grpcio = "^1.51.3"
numpy = [
{python = "^3.9", version = "^1.26"},
{python = "^3.8, <3.12", version = "^1.24"}
]
protobuf = "^5.28.1"
python = "^3.8, <3.13"
python-dateutil = "^2.8.2"
tm_data_types = "^0.1.0"
typing_extensions = "^4.12.0"
tzlocal = "^5.2"
[tool.poetry.group.dev.dependencies]
docutils = "^0.20" # TODO: Drop Python 3.8: remove this when the minimum Python version is >=3.9
docutils-stubs = "^0.0.22"
matplotlib = [
{python = ">=3.9", version = "^3.8"},
{python = "3.8", version = "^3.7"}
]
nodeenv = "^1.9.1"
pip = "^24.0"
poetry = "^1.8.0"
poetry-audit-plugin = "^0.4.0"
poetry-plugin-export = "^1.7.1"
poetry-pre-commit-plugin = "^0.1.2"
pre-commit = [
{python = ">=3.9", version = "^3.7"},
{python = "3.8", version = "^3.5"}
]
pylint = "3.2.7"
pyright = {extras = ["nodejs"], version = "^1.1.387"}
pyroma = "^4.2"
pyvisa = "^1.14.1"
tm_devices = "^2.3.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"
[tool.poetry.group.docs.dependencies]
black = "^24.4.2"
codespell = "^2.2.6"
griffe = "^1.1.0"
mkdocs = "^1.6.0"
mkdocs-ezglossary-plugin = "^1.6.10"
mkdocs-gen-files = "^0.5.0"
mkdocs-include-markdown-plugin = "^6.0.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.26.1"
mkdocstrings-python = "^1.10.2"
nodeenv = "^1.9.1"
packaging = "^24.2"
pygments = "^2.17.2"
pymdown-extensions = "^10.8.1"
requests = "^2.32.3"
symspellpy = "^6.7.7"
tomli = "^2.0.1"
[tool.poetry.group.tests.dependencies]
coverage = "^7.5.0"
linkchecker = "^10.0.0"
psutil = "^6.0.0"
pytest = "^8.2.0"
pytest-cov = "^5.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/TekHSI/issues"
"Changelog" = "https://github.com/tektronix/TekHSI/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",
"^\\tests*",
"^_tek_highspeed_server_pb2.pyi",
"^_tek_highspeed_server_pb2\\.py",
"^_tek_highspeed_server_pb2_grpc\\.py",
"^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.8"
recursive = true
[tool.pylint."messages control"]
enable = ["all"]
disable = [
"broad-exception-caught", # caught by ruff
"consider-using-with", # TODO: enable this check
"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-statements", # caught by ruff
"too-many-statements", # caught by ruff
"undefined-variable", # caught by ruff
"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.8"
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 = [
"ignore:Type google._upb._message.:DeprecationWarning"
]
junit_family = "xunit2"
junit_logging = "all"
log_format = "[%(asctime)s] [%(levelname)8s] %(message)s"
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 = "py38" # always generate Python 3.8 compatible code
[tool.ruff.lint]
allowed-confusables = []
fixable = ["ALL"]
flake8-pytest-style = {mark-parentheses = false}
flake8-quotes = {docstring-quotes = "double"}
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in *args and **kwargs (allowed in this package)
"COM812", # Trailing comma missing (handled by formatter)
"FA100", # Missing `from __future__ import annotations`, but uses ... (allowed in this package)
"FIX002", # Line contains TO DO (allowed in this package)
"ISC001", # single-line-implicit-string-concatenation (handled by formatter)
"TD002", # Missing author in TO DO (allowed in this package)
"TD003", # Missing issue link on the line following this TO DO (allowed in this package)
"UP006", # Use {to} instead of {from} for type annotation (allowed in this package)
"UP007", # Use `X | Y` for type annotations (allowed in this package)
"UP024", # Replace aliased errors with `OSError` (allowed in this package)
"UP037" # Remove quotes from type annotation (allowed in this package)
]
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 = [
"tekhsi"
]
known-local-folder = [
"server",
"tests"
]
lines-between-types = 1
order-by-type = false
[tool.ruff.lint.per-file-ignores]
"examples/**" = [
"E501", # Line too long
"ERA001", # Found commented-out code
"S101", # Use of assert detected
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"T201" # `print` found
]
"src/tekhsi/_tek_highspeed_server_pb2*.py*" = [
"ALL"
]
"tests/**" = [
"D104", # Missing docstring in public package
"PLC1901", # compare-to-empty-string
"PLR2004", # Magic value used in comparison
"S101", # Use of assert detected
"T201" # `print` found
]
"tests/server/tekhsi_test_server.py" = [
# TODO: remove this entire ignore section
"ANN",
"BLE001",
"D102",
"D107",
"N80",
"PLW0602",
"PLW0603",
"SIM",
"SLF001" # Private member accessed
]
"tests/test_client.py" = [
"FBT001", # Boolean-typed positional argument in function definition
"SLF001" # Private member accessed
]
[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
overrides."tool.poetry.*".inline_arrays = false
overrides."tool.pylint.*".table_keys = false
[tool.tox]
legacy_tox_ini = """
[tox]
requires = tox>4
isolated_build = True
envlist = py38,py39,py310,py311,py312,tests,docs,doctests
skip_missing_interpreters = True
labels =
basic = py38,py39,py310,py311,py312,tests
documentation = docs,doctests
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
[testenv]
package = wheel
install_command = python -I -m pip install --upgrade --upgrade-strategy=eager {opts} {packages}
deps =
poetry
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 (yamlfix should be removed from this list once Python 3.8 support is dropped)
SKIP = file-contents-sorter,yamlfix
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
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
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
"""