-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
231 lines (211 loc) · 6.39 KB
/
pyproject.toml
File metadata and controls
231 lines (211 loc) · 6.39 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
[project]
name = "urst-python"
version = "0.1.0"
description = "Universal Reliable Serial Transport (URST) protocol implementation for Python"
readme = "README.md"
authors = [
]
requires-python = ">=3.8"
dependencies = [
"pyserial>=3.5",
"typing-extensions>=4.0.0; python_version<'3.10'"
]
keywords = ["serial", "communication", "protocol", "embedded", "urst"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Communications",
"Topic :: Software Development :: Libraries :: Python Modules",
]
[project.urls]
Homepage = "https://github.com/simonl65/URST-Python"
Repository = "https://github.com/simonl65/URST-Python"
Documentation = "https://github.com/simonl65/URST-Python#readme"
Issues = "https://github.com/simonl65/URST-Python/issues"
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-mock>=3.10.0",
"mypy>=1.0.0",
"ruff>=0.1.0",
"pre-commit>=3.0.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/urst"]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--cov=src/urst",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-report=xml",
"--cov-fail-under=95",
"--strict-markers",
"--strict-config",
"-v"
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"performance: marks tests as performance tests",
"interop: marks tests as interoperability tests",
"stress: marks tests as stress tests",
"unit: marks tests as unit tests"
]
filterwarnings = [
"error",
"ignore::UserWarning",
"ignore::DeprecationWarning",
"ignore::PendingDeprecationWarning"
]
minversion = "7.0"
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true
show_error_codes = true
show_column_numbers = true
show_error_context = true
pretty = true
# Per-module options
[[tool.mypy.overrides]]
module = "serial.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
[tool.ruff]
target-version = "py38"
line-length = 88
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"N", # pep8-naming
"D", # pydocstyle
"S", # flake8-bandit (security)
"T20", # flake8-print
"PT", # flake8-pytest-style
"RET", # flake8-return
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate (commented code)
"PL", # pylint
"TRY", # tryceratops
"FLY", # flynt
"PERF", # perflint
]
ignore = [
"E501", # line too long, handled by ruff format
"B008", # do not perform function calls in argument defaults
"C901", # too complex
"D100", # missing docstring in public module
"D104", # missing docstring in public package
"D107", # missing docstring in __init__
"D203", # 1 blank line required before class docstring
"D213", # multi-line docstring summary should start at the second line
"S101", # use of assert detected (we use asserts in tests)
"PLR0913", # too many arguments to function call
"PLR2004", # magic value used in comparison
"TRY003", # avoid specifying long messages outside the exception class
"PLR0912", # too many branches
"PLR0915", # too many statements
"TRY300", # consider moving to else block (often not applicable)
"TRY301", # abstract raise to inner function (often not worth it)
"TRY400", # use logging.exception (we prefer explicit error messages)
"TRY401", # redundant exception in logging.exception (we want context)
"B904", # raise from err (we handle this appropriately)
"ARG001", # unused function argument (common in interfaces)
"ARG002", # unused method argument (common in interfaces)
"ERA001", # commented code (sometimes useful for documentation)
"SIM108", # ternary operator (readability preference)
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.ruff.lint.isort]
known-first-party = ["urst"]
force-sort-within-sections = true
split-on-trailing-comma = true
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pylint]
max-args = 8
max-branches = 15
max-returns = 8
max-statements = 60
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"B011", # do not call assert False since python -O removes these calls
"S101", # use of assert detected
"D", # pydocstyle (don't require docstrings in tests)
"PLR2004", # magic value used in comparison (common in tests)
"ARG001", # unused function argument (common in test fixtures)
"T20", # flake8-print (print statements ok in tests)
]
"examples/*" = [
"T20", # flake8-print (print statements ok in examples)
"S101", # use of assert detected (examples may use asserts)
]
[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
[dependency-groups]
dev = [
"mypy>=1.14.1",
"pytest>=8.3.5",
"pytest-cov>=5.0.0",
"pytest-mock>=3.14.1",
"ruff>=0.14.0",
]