-
Notifications
You must be signed in to change notification settings - Fork 21
/
pyproject.toml
498 lines (459 loc) · 15.1 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
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.9.0"]
[tool]
[tool.coverage.coverage_conditional_plugin.rules]
py-gte-39 = "sys_version_info >= (3, 9)"
py-lt-39 = "sys_version_info < (3, 9)"
[tool.coverage.paths]
source = [
".tox/**/site-packages/tm_devices",
"src/tm_devices"
]
[tool.coverage.report]
exclude_lines = [
"if TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError"
]
fail_under = 100
omit = [
"**/tm_devices/commands/**" # TODO: remove this exclusion
]
show_missing = true
skip_empty = true
[tool.coverage.run]
branch = true
cover_pylib = false
plugins = ["coverage_conditional_plugin"]
source = ["tm_devices"]
[tool.docformatter]
close-quotes-on-newline = true
in-place = true
recursive = true
wrap-descriptions = 100
wrap-summaries = 0
[tool.poetry]
authors = [
"Tektronix <[email protected]>",
"Nicholas Felt <[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 = "Manage connections and interactions with Test & Measurement devices."
documentation = "https://tm-devices.readthedocs.io/stable/"
homepage = "https://pypi.org/project/tm_devices/"
keywords = [
"REST API",
"SCPI",
"TSP",
"Tektronix",
"Test & Measurement",
"VISA"
]
license = "Apache-2.0"
maintainers = [
"Tektronix <[email protected]>",
"Nicholas Felt <[email protected]>"
]
name = "tm_devices"
readme = "README.md"
repository = "https://github.com/tektronix/tm_devices"
version = "2.5.0"
[tool.poetry.dependencies]
colorlog = "^6.9.0"
gpib-ctypes = "^0.3.0"
libusb-package = "^1.0.26.0,!=1.0.26.2" # 1.0.26.2 doesn't work with Python 3.12
packaging = "^24.0"
psutil = "^6.0.0"
pyserial = "^3.5"
python = "^3.8" # This is the main Python version requirement
python-dateutil = "^2.8.2"
pyusb = "^1.2.1"
pyvicp = "^1.1.0"
pyvisa = "^1.12.0"
pyvisa-py = "^0.7.2"
pyvisa-sim = "^0.6.0"
pyyaml = "^6.0"
requests = "^2.31.0"
tomli = "^2.0.1"
tomli-w = "^1.0.0"
traceback-with-variables = "^2.0.4"
typing-extensions = "^4.10.0"
tzlocal = "^5.2"
urllib3 = "^2.0"
zeroconf = "^0.136.0"
[tool.poetry.group.dev.dependencies]
docutils = "^0.20" # TODO: Drop Python 3.8: remove this when the minimum Python version is >=3.9
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.389"}
pyroma = "^4.2"
tox = "^4.0"
tox-gh-actions = "^3.1.0"
twine = "^5.0.0"
types-python-dateutil = "^2.9"
types-pyyaml = "^6.0"
types-requests = "^2.31"
wheel = "^0.45.0"
[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.0"
mkdocstrings-python = "^1.10.2"
nodeenv = "^1.9.1"
packaging = "^24.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"
coverage-conditional-plugin = "^0.9.0"
flask = "^3.0.3"
http-server-mock = "^1.7"
linkchecker = "^10.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"
ruff = "0.8.0"
[tool.poetry.scripts]
list-visa-resources = "tm_devices:print_available_visa_devices"
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/tektronix/tm_devices/issues"
"Changelog" = "https://github.com/tektronix/tm_devices/blob/main/CHANGELOG.md"
[tool.pylint.basic]
good-names = ["_"]
[tool.pylint.design]
max-args = 7
[tool.pylint.dunder]
good-dunder-names = [
"__isabstractmethod__"
]
[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.8"
recursive = true
[tool.pylint."messages control"]
enable = ["all"]
disable = [
"broad-exception-caught", # caught by ruff
"duplicate-code",
"fixme", # caught by ruff
"global-statement", # caught by ruff
"import-private-name", # caught by pyright
"invalid-name", # caught by ruff
"line-too-long", # caught by ruff
"locally-disabled", # allowed
"missing-class-docstring", # caught by ruff
"missing-function-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-ancestors", # 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
"unexpected-keyword-arg", # caught by pyright
"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.0 * error + (warning + refactor + convention + info)) / statement) * 10.0))"
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 = "none" # this check is not needed
reportImplicitStringConcatenation = "none" # this is allowed by this project's formatting standard
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 = "none" # the auto-generated properties can have mismatches
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
# Pytest configuration
[tool.pytest.ini_options]
addopts = "--order-scope=module --cov-config=pyproject.toml"
doctest_optionflags = "ELLIPSIS NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL"
filterwarnings = [
"ignore:'xdrlib' is deprecated:DeprecationWarning",
"ignore::DeprecationWarning:pkg_resources",
"ignore:GPIB library not found:UserWarning",
"ignore:pkg_resources is deprecated: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.rstcheck]
ignore_directives = [
"autoapisummary" # This is added by sphinx-autoapi
]
[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 (allowed in this package)
"FA100", # Missing `from __future__ import annotations`, but uses ... (allowed in this package)
"FBT", # flake8-boolean-trap # TODO: enable this
"FIX002", # Line contains TO DO (allowed in this package)
"ISC001", # single-line-implicit-string-concatenation (handled by formatter)
"PYI021", # Docstrings should not be included in stubs (allowed in this package)
"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 = [
"conftest",
"mock_server",
"tm_devices"
]
lines-between-types = 1
order-by-type = false
[tool.ruff.lint.per-file-ignores]
"examples/**" = [
"FBT", # flake8-boolean-trap
"S101", # Use of assert detected
"T201" # `print` found
]
"examples/miscellaneous/custom_device_driver_support.py" = [
"ARG002", # Unused method argument
"D102" # Missing docstring in public method
]
"src/tm_devices/commands/**" = [
"A003", # Class attribute is shadowing a python builtin
"D104", # Missing docstring in public package
"D107", # Missing docstring in `__init__`
"ERA001", # Found commented-out code
"S105", # Possible hardcoded password
"TID252" # Relative imports from parent modules are banned
]
"tests/**" = [
"PLC1901", # compare-to-empty-string
"PLR2004", # Magic value used in comparison
"PTH107", # `os.remove()` should be replaced by `Path.unlink()`
"S101" # Use of assert detected
]
"tests/samples/golden_stubs/**" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D107", # Missing docstring in `__init__`
"PYI053" # String and bytes literals longer than 50 characters are not permitted
]
[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
# Tox configuration
[tool.tox]
legacy_tox_ini = """
[tox]
requires = tox>4
isolated_build = True
envlist = py38,py39,py310,py311,py312,py313,tests,docs,doctests
skip_missing_interpreters = True
labels =
basic = py38,py39,py310,py311,py312,py313,tests
documentation = docs,doctests
[gh-actions]
python =
3.8: py38
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 =
PYRIGHT_PYTHON_GLOBAL_NODE # If set outside of tox, this will cause python-pyright to use nodeenv to install node rather than use the system node
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
!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
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
"""