Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
303 lines (249 loc) · 8.01 KB
/
Copy pathpyproject.toml
File metadata and controls
303 lines (249 loc) · 8.01 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
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
############################################################
# PROJECT METADATA #
############################################################
[project]
name = "mpflash"
version = "1.29.3"
description = "Flash and download tool for MicroPython firmwares"
authors = [
{name = "Jos Verlinde", email = "jos_verlinde@hotmail.com"}
]
license = {text = "MIT"}
readme = "README.md"
keywords = ["MicroPython", "firmware", "flash", "download", "UF2", "esptool"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: MicroPython",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Hardware",
"Topic :: Utilities",
]
requires-python = ">=3.10"
dependencies = [
"beautifulsoup4>=4.12.3",
"bincopy>=20.0.0",
"blkinfo>=0.2.0",
"cachetools>=5.3.0",
"esptool>=5.0.0",
"questionary>=2.0.0",
"jsonlines>=4.0.0",
"jsons>=1.6.3",
"pywin32>=310; sys_platform == 'win32'",
"loguru>=0.7.2",
"mpremote>=1.22.0",
"packaging>=24.2",
"platformdirs>=4.2.0",
"psutil>=7.0.0,<8.0.0",
"pygithub>=2.1.1",
"pyusb>=1.2.1",
"requests>=2.31.0",
"rich-click>=1.8.1",
"tenacity==9.1.4",
"diskcache>=5.6.0",
"tomli-w>=1.2.0",
"tomli>=2.2.1",
"peewee>=4.0.3",
"libusb-package>=1.0.26.0; sys_platform == 'win32'",
"python-dotenv>=1.0.0",
]
[project.optional-dependencies]
dev = [
"keyring>=25.6.0",
]
test = [
"pytest>=7.1.2,<10.0.0",
"pytest-cov>=6.0.0",
"pytest-github-actions-annotate-failures>=0.1.7,<0.5.0",
"pytest-json-report>=1.5.0",
"pytest-metadata>=2.0.2,<4.0.0",
"pytest-mock>=3.10.0",
"coverage>=6.4.3,<8.0.0",
"distro>=1.8.0",
"fasteners>=0.19",
"mock>=4.0.3,<6.0.0",
"tuna>=0.5.11",
"pyinstrument>=5.1.0",
]
# perf = [
# "scalene>=1.5.51",
# ]
pyocd = [
"pyocd>=0.44.1",
# TODO: remove the libusb-package pin when 3.14 wheels are available for libusb
"libusb-package==1.0.26.1; python_version >= '3.14'",
]
build = [
"mpbuild>=1.0.0; python_version >= '3.12'",
"mpbuild>=0.5.0,<1.0.0; python_version < '3.12'", # Keep 0.5.x fallback for older Pythons
]
[project.scripts]
mpflash = "mpflash.cli_main:mpflash"
# Entry-point group used by third-party packages to register additional flash
# backends. Each entry must point at a FlashBackend subclass or instance.
# Built-in backends are imported directly by ``mpflash.flash.builtins`` and do
# not need to be listed here.
[project.entry-points."mpflash.flash_plugins"]
# Example (commented out):
# my-backend = "mypkg.backend:MyBackend"
[project.urls]
Homepage = "https://github.com/Josverl/mpflash"
Documentation = "https://github.com/Josverl/mpflash/blob/main/README.md"
Repository = "https://github.com/Josverl/mpflash"
"Bug Tracker" = "https://github.com/Josverl/mpflash/issues"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build]
reproducible = true
############################################################
# PYRIGHT #
############################################################
[tool.pyright]
include = ["mpflash", "tests"]
exclude = [
"**/.venv", "**/node_modules", "**/__pycache__", "**/.*",
]
ignore = [
]
pythonVersion = "3.10"
pythonPlatform = "All"
typeCheckingMode = "basic"
############################################################
# PYTEST #
############################################################
[tool.pytest.ini_options]
minversion = "7.0"
python_functions = ["test_", "*_test"]
python_files = ["test_*.py", "*_test.py"]
testpaths = ["tests"]
norecursedirs = [".*", ".*/*"]
junit_family = "xunit1"
addopts = "--capture=no --cov-branch --cov-report=xml -m 'not slow'"
# --capture=no
markers = [
"mpflash: marks tests of the mpflash tool",
"basicgit: rather slow tests for basicgit",
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: Integration tests (slower)",
"mocked: to replace/compensate for most of the slow and git tests",
#
"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",
# Hardware-in-the-loop markers — see tests/hw/conftest.py.
"hardware: hardware-in-the-loop tests (require physical board)",
"hw_uf2: requires a UF2-capable board attached",
"hw_dfu: requires an STM32 board in DFU mode attached",
"hw_esptool: requires an ESP32/ESP8266 board attached",
"hw_pyocd: requires a CMSIS-DAP / J-Link probe + target attached",
# micropython version dependencies
]
############################################################
# Coverage (pytest-cov) #
############################################################
# coverage reports
[tool.coverage.run]
parallel = false
branch = true
source = ["mpflash"]
omit = [
# micropython code
"mpflash/mpremoteboard/mpy_fw_info.py",
# vendored
"mpflash/vendor/*",
# 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",
"log.debug\\(",
"log.warning\\(",
# 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:",
"except requests.RequestException 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:",
]
############################################################
# RUFF linter #
############################################################
[tool.ruff]
# Exclude a variety of commonly ignored directories.
# Same as Black.
line-length = 140
indent-width = 4
#Minimum supported Python version
target-version = "py310"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
exclude = [".*", "__*", "dist", "repos"]
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.lint]
exclude = [".*", "__*", "dist", "repos", "mpflash\\vendor"]
ignore = ["F821"]
[dependency-groups]
dev = [
"keyring>=25.7.0",
"pytest>=8.4.1",
"pytest-mock>=3.15.0",
]