forked from tai/cyusb-hack
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
200 lines (180 loc) · 5.75 KB
/
pyproject.toml
File metadata and controls
200 lines (180 loc) · 5.75 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
[project]
name = "cy_serial_bridge"
# this is used by Ruff to disable "upgrade to feature x" inspections where x was added
# after the given version
requires-python = ">=3.10"
version = "0.4.1"
description = "Pure Python driver for using and reconfiguring the CY7C652xx family of USB to SPI/I2C/UART bridge ICs."
authors = [
{name = "Jamie Smith", email = "smit109@usc.edu"},
]
readme = "README.md"
license = "LGPL-3.0"
classifiers = [
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 4 - Beta",
# Indicate who your project is intended for
"Intended Audience :: Developers",
"Topic :: Software Development :: Embedded Systems",
# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"libusb1>=3.0",
"pyserial>=3.5",
"typer>=0.16", # Make sure to get at least this version for Click 8.2 support
"rich>=13.6",
"click>=8.0"
]
[project.urls]
source = "https://github.com/mbed-ce/cy_serial_bridge/"
issues = "https://github.com/mbed-ce/cy_serial_bridge/issues"
[project.scripts]
cy_serial_cli = 'cy_serial_bridge.cli:main'
[tool.poetry]
include = ['CHANGELOG.md', 'LICENSE', 'py.typed',]
packages = [
{ include = 'cy_serial_bridge', from = 'src' },
]
[tool.poetry.group.dev.dependencies]
pytest = ">=6.2"
pytest-mock = ">=3.13.0"
mypy = ">=1.8"
ruff = '>=0.9'
types-pyserial = ">=3.5.0"
[tool.pytest.ini_options]
minversion = '6.0'
testpaths = [
'tests',
]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
line-length = 120
show-fixes = true
src = ['src',]
[tool.ruff.lint]
select = [
'A', # Builtins
'ANN', # Annotations
'ARG', # Unused arguments
'B', # Bugbear
# 'BLE', # Blind except - disabled because sometimes you *don't* know what exceptions something will generate
'C4', # Comprehensions
'C90', # mccabe
'COM', # Commas
'D2', # Docstring conventions
'DTZ', # Datetimes
'EM', # Error messages
# 'ERA', # Commented-out code - disabled because it generates false positives for comments with C structs
'EXE', # Executable
'F', # Pyflakes
'FA', # __future__ annotations
'FLY', # F-strings
# 'FURB', # Refurb
'G', # Logging format
'I', # Isort
'ICN', # Import conventions
'INP', # Disallow PEP-420 (Implicit namespace packages)
'INT', # gettext
'ISC', # Implicit str concat
# 'LOG', # Logging
'N', # PEP-8 Naming
'NPY', # Numpy
'PERF', # Unnecessary performance costs
'PGH', # Pygrep hooks
'PIE', # Unnecessary code
'PL', # Pylint
'PT', # Pytest
'PTH', # Use Pathlib
'PYI', # Stub files
'Q', # Quotes
'RET', # Return
'RUF', # Ruff
'RSE', # Raise
'S', # Bandit
'SIM', # Code simplification
'SLF', # Private member access
'SLOT', # __slots__
'T10', # Debugger
# 'T20', # Print - disabled because we are implementing a CLI and need to use print
'TCH', # Type checking
'TID', # Tidy imports
'TRY', # Exception handling
'UP', # Pyupgrade
'W', # Warnings
'YTT', # sys.version
]
# Allow automatic fixes for the following
extend-safe-fixes = [
"TC002" # Type checking blocks
]
ignore = [
'D203', # One blank line before class docstring
'D212', # Multi-line summary first line
'PLR0913', # Too many arguments
'Q000', # Single quotes found but double quotes preferred
'F405', # Star imports
'F403', # Star imports
'D200', # One-line docstring should fit on one line
'S101', # Assert statements
'RET505', # Unnecessary `elif` after `return` statement
'RET506', # Unnecessary `else` after `raise` statement
'S311', # Allow use of `random` module
'TRY003', # Inline exception messages - Redundant with EM101
'COM812', # Missing trailing commas - incompatible with formatter
'ISC001', # Single line implicit string concatenation - incompatible with formatter
'TRY301', # Don't call raise within a try block -- can I help it if other libraries don't use exceptions??
'TRY300', # Returns within try blocks
'PLR2004', # Magic value used in comparison
'ANN401', # Allow typing.any
'UP007', # Allow old style union annotations (typing.Optional/typing.Union). Typer does not support the new style ones.
'PYI025', # Allow using collections.abc.Set
'SIM102', # Allow multiple nested if statements. Sometimes it's nice for readability
'UP031', # Allow percent formatting, it can be useful sometimes!
'PLC0414', # Allow 'import x as x', needed for exporting type names
]
exclude = ["stubs/*"]
[tool.ruff.lint.flake8-quotes]
docstring-quotes = 'double'
multiline-quotes = 'double'
[tool.ruff.lint.mccabe]
max-complexity = 24
[tool.ruff.lint.per-file-ignores]
# https://beta.ruff.rs/docs/rules/
'__init__.py' = ['F401','F403','F405',]
'tests/*' = [
'ANN',
'ARG',
'INP001',
'S101',
'N802', # Allow non-snake_case function names, because we need to mock usb1 functions
]
'hardware_tests/*' = ['ANN', 'ARG', 'INP001', 'S101',]
[tool.ruff.lint.pylint]
max-args = 15
max-branches = 24
max-returns = 10
max-statements = 80
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = 'all'
# Allow __init__ to not have a return type annotation
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
[tool.pyright]
stubPath = "./stubs"
exclude = [
"stubs"
]
reportWildcardImportFromLibrary = false
[tool.mypy]
strict = true
mypy_path = "$MYPY_CONFIG_FILE_DIR/stubs"