-
Notifications
You must be signed in to change notification settings - Fork 14
/
pyproject.toml
381 lines (328 loc) · 9.99 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
[tool.micropython-stubber]
stub-path = "./repos/micropython-stubs/stubs"
repo-path = "./repos"
# publish-path = "./repos/micropython-stubs/publish"
# template-path = "./repos/micropython-stubs/publish/template"
[tool.poetry]
name = "micropython-stubber"
version = "1.23.2a0"
description = "Tooling to create and maintain stubs for MicroPython"
authors = ["Jos Verlinde <jos_verlinde@hotmail.com>"]
license = "MIT"
readme = "readme.md"
keywords = [
"MicroPython",
"stubs",
"vscode",
"pyright",
"linting",
"static type check",
]
documentation = "https://micropython-stubber.readthedocs.io/"
homepage = "https://github.com/Josverl/micropython-stubber#readme"
repository = "https://github.com/Josverl/micropython-stubber"
classifiers = [
"Programming Language :: Python :: Implementation :: MicroPython",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Text Editors :: Integrated Development Environments (IDE)",
"Topic :: Software Development :: Build Tools",
]
packages = [{ include = "**/*.*", from = "src" }]
include = []
exclude = [
"**/tests/**",
"**/*-test",
"**/samples.py",
"**/OneOff",
"**/.vscode",
]
[tool.poetry.scripts]
stubber = "stubber.stubber:stubber_cli"
mpflash = "mpflash.cli_main:mpflash"
mpremote = "mpremote.main:main"
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
python-minifier = { version = "^2.7.0", python = "<3.14" }
requests = "^2.32.3"
mypy = "1.10.1"
mpflash = "^1.0.3"
mpremote = "^1.23.0"
# others
autoflake = ">=1.7,<3.0"
black = ">=22.10,<25.0"
libcst = "^1.1.0"
cachetools = "^5.3.0"
click = "^8.1.3"
executing = "^2.0.1"
importlib-metadata = { version = ">=1,<9", python = "<3.8" }
loguru = ">=0.6,<0.8"
mypy-gitlab-code-quality = "^1.1.0"
packaging = ">=21.3,<24.0"
pipx = "^1.1.0"
pygithub = "^2.1.1"
pyright = "^1.1.341"
pyserial = "^3.5"
pysondb-v2 = "^2.1.0"
pypi-simple = "^1.0.0"
rich-click = "^1.8.3"
tabulate = "^0.9.0"
tenacity = "^8.2.2"
tomli = { version = "^2.0.1", python = "<3.11" }
tomli-w = "^1.0.0"
typed-config = "^1.3.0"
urllib3 = "^2.2.2"
[tool.poetry.group.docs]
optional = true
[tool.poetry.group.docs.dependencies]
sphinx = "^7.2.6"
myst-parser = ">=0.17"
sphinx_rtd_theme = ">=1,<3"
sphinx-autoapi = "^3.0.0"
sphinx-click = "6.0.0"
sphinxcontrib-mermaid = ">=0.9.2"
[tool.poetry.group.test]
optional = true
[tool.poetry.group.test.dependencies]
coverage = ">=6.4.3,<8.0.0"
pytest = "^7.1.2"
pytest-github-actions-annotate-failures = ">=0.1.7,<0.3.0"
pytest-json-report = "^1.5.0"
pytest-metadata = ">=2.0.2,<4.0.0"
pytest-mock = "^3.10.0"
mock = "^4.0.3"
distro = "^1.8.0"
fasteners = "^0.19"
jsons = "^1.6.3"
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
pydeps = "^1.10.22"
ipykernel = "^6.23.1"
python-dotenv = "^1.0.0"
pydocstyle = "^6.3.0"
chime = "^0.7.0"
bincopy = "^20.0.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
# Init with : poetry self add poetry-bumpversion
[tool.poetry_bumpversion.file."src/stubber/__init__.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs_mem.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs_db.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs_min.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs_mem_min.py"]
[tool.poetry_bumpversion.file."src/stubber/board/createstubs_db_min.py"]
[[tool.poetry_bumpversion.replacements]]
files = [
"package.json",
"mip/full.json",
"mip/minified.json",
"mip/mpy_v5.json",
"mip/mpy_v6.json",
]
search = '"version": "{current_version}"'
replace = '"version": "{new_version}"'
[tool.pyright]
include = ["src", "tests"]
exclude = [
"snippets",
"src/stubber/board",
"src/stubber/board/*_min.py",
"**/all-stubs",
"src/stubber/board/stubs",
"**/.venv",
]
ignore = [
"tests/mocks",
"tests/data",
"tests/codemods",
"**/cst-test",
"snippets/**/typings",
]
# section 1
pythonVersion = "3.8"
pythonPlatform = "All"
verboseOutput = false
typeCheckingMode = "basic" # ["off", "basic", "strict"]: Specifies the default rule set to use
# section 2
reportMissingImports = "error"
reportGeneralTypeIssues = "error" # interesting
reportUndefinedVariable = "warning" # "_WHO_AM_I_REG" is not defined - Not a showstopper
reportOptionalCall = "information" # Object of type "None" cannot be called
reportInvalidStringEscapeSequence = "information"
reportUnboundVariable = "information"
ReportSelfClsParameterName = "information"
reportOptionalSubscript = "information"
reportCallInDefaultInitializer = "error"
# Section 3 - reduce noise
reportMissingTypeStubs = "none"
reportOptionalMemberAccess = "none" # "read" is not a known member of "None" - occurs often in frozen code
reportWildcardImportFromLibrary = "none"
reportUnknownArgumentType = "none"
reportSelfClsParameterName = "none"
reportMissingModuleSource = "none"
reportUnknownParameterType = "none"
reportMissingTypeArgument = "none"
reportUnknownMemberType = "none"
reportUnknownLambdaType = "none"
reportUnknownVariableType = "none"
reportUntypedNamedTuple = "none"
# "executionEnvironments" = [
# { "root" = "src/stubber/boards", "extraPaths" = [
# "typings_mpy",
# ] },
# { "root" = "src/stubber", "extraPaths" = [
# ] },
# ]
[tool.black]
# use long lines to avoid _log lines from wrapping , as this causes issues with the minification.
line-length = 140
# target_version = ['py38']
include = '\.pyi?$'
exclude = '''
(
/(
| minified
| repos[\\/]micropython
| repos[\\/]micropython-lib
| repos[\\/]micropython-stubs
| tests[\\/]mocks
| tests[\\/]data
| tests[\\/]rst[\\/]data
| tests[\\/]codemods[\\/]codemod_test_cases
| typings
| snippets[\\/].*?[\\/]typings
| scratch
| src[\\/]stubber[\\/]codemod[\\/]_partials
)/
)
'''
[tool.pytest.ini_options]
minversion = "7.0"
python_functions = ["test_", "*_test"]
python_files = ["test_*.py", "*_test.py"]
testpaths = [
"tests",
"src/stubber",
"src/mpflash",
"repos/micropython-stubs/tests",
"modules/**/tests",
]
norecursedirs = [
".*",
".*/*",
# "repos/*",
"tests/codemods/codemod_test_cases/*",
"typings*",
]
junit_family = "xunit1"
addopts = "--verbose --capture=no -m 'not basicgit'"
# -m 'not snippets'
# --numprocesses=auto
# -m MARKEXPR Only run tests matching given mark expression. For example: -m 'mark1 and not mark2'.
# -n --numprocesses=numprocesses -
markers = [
"stubber: marks tests of the stubber tool",
"mpflash: marks tests of the mpflash tool",
"snippets: test snippets to check the stubs",
"legacy: reeally old tests that need to be updated or removed",
"version: run test only on specific MicroPython version",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: Integration tests (slower)",
"basicgit: marks tests in the basicgit module that manipulate the checkout",
"mocked: to replace/compensate for most of the slow and git tests",
#
"minified: marks test of the minified version of createstubs",
"minify: marks test of the minification of createstubs",
"native: Createstubs run against a native micropython implementation",
"docfix: upstream documentation fix needed",
"micropython: tests of MicroPython code on Cpython with mocks",
"doc_stubs: tests to generate stubs from the rst documentation",
"codemod: test libcst code modification",
"cli: test command line interface",
# os platforms
"win32: run test only on Windows",
"linux: run test only on linux",
"darwin: run test only on Mac",
# micropython version dependencies
]
# coverage reports
[tool.coverage.run]
parallel = false
branch = true
source = ["src/stubber", "src/mpflash"]
omit = [
# helper files in board
"*/boot.py",
"*/main.py",
"*/stub_lvgl.py",
# dev helper script in src
"*/src/stubber/rst/report_return.py",
"*/src/stubber/update_module_list.py",
# not my code
"*/src/stubber/tools/*.py",
"*/src/mpflash/mpflash/vendored/*.py",
# partial files for variant generation
"*/codemod/_partials/*.py",
# pytest code
"*/test_*.py",
"*/*_test.py",
]
[tool.coverage.html]
directory = "coverage"
[tool.coverage.xml]
output = "results/coverage.xml"
[tool.coverage.json]
output = "results/coverage.json"
[tool.coverage.lcov]
output = "results/coverage.lcov"
[tool.coverage.report]
show_missing = true
# Regexes for lines to exclude from consideration
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
"pragma: nocover",
# Don't complain about missing debug-only code:
"def __repr__",
"self._log.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
"except subprocess.CalledProcessError as e:",
"except OSError:",
"except OSError as e:",
"except OSError as e2:",
"except (OSError, KeyError):",
"except (OSError, AttributeError):",
"except (OSError, KeyError, NameError):",
"except KeyError:",
"except AttributeError as e:",
# Don't complain if non-runnable code isn't run:
"if __name__ == .__main__.:",
# mind the quotes
'if __name__ == "__main__" or isMicroPython():',
"main()",
# utility functions
"show_help()",
"isMicroPython()",
"read_path()",
#unreachable
# mind the quotes
'info["release"] = "2.0.0" ',
"if arch",
# Micropython detection
"except (NotImplementedError, SyntaxError):",
# catch error
"except (OSError, KeyError):",
"except (OSError, AttributeError):",
# Backward compat <= 3.7
"if sys.version_info.major == 3 and sys.version_info.minor <= 7:",
]
[tool.sourcery-analytics]
[tool.sourcery-analytics.thresholds]
method_length = 50
method_cyclomatic_complexity = 99
method_cognitive_complexity = 99
method_working_memory = 99