forked from Argmaster/pygerber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
313 lines (297 loc) · 13.9 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
[tool.poetry]
name = "pygerber"
version = "2.3.0"
description = "Parsing, formatting and rendering toolkit for Gerber X3 file format"
authors = ["Krzysztof Wisniewski <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://www.facebook.com/pygerber"
repository = "https://github.com/Argmaster/pygerber"
documentation = "https://argmaster.github.io/pygerber/latest"
keywords = ["gerber", "pcb", "embedded", "images", "x3"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Information Technology",
"Intended Audience :: Manufacturing",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: File Formats",
"Topic :: Multimedia",
"Topic :: Multimedia :: Graphics",
"Topic :: Multimedia :: Graphics :: Presentation",
"Topic :: Multimedia :: Graphics :: Viewers",
"Topic :: Printing",
"Topic :: Scientific/Engineering :: Visualization",
"Topic :: Software Development :: Embedded Systems",
"Topic :: Utilities",
"Typing :: Typed",
]
[tool.poetry.dependencies]
python = "^3.8,<3.13"
click = "^8.1.3"
pyparsing = "^3.1.0"
pydantic = "^2.3"
tzlocal = "^5.0.1"
pillow = "^10.0.0"
numpy = [
{ version = "^1.24.4", markers = "python_version >= '3.8' and python_version <= '3.11'" },
{ version = "^1.26.1", markers = "python_version >= '3.12' and python_version < '3.13'" },
]
pyyaml = "^6.0.1"
pygls = { version = "^1.0.2", optional = true }
lsprotocol = { version = "^2023.0.0a3", optional = true }
drawsvg = { version = "^2.3.0", optional = true }
[tool.poetry.group.dev.dependencies]
mypy = "^1.6.1"
poethepoet = ">=0.20,<0.26"
pytest = ">=7.4,<9.0"
ruff = ">=0.1.3,<0.4.0"
jinja2 = "^3.1.2"
pyyaml = "^6.0"
pre-commit = "^3.3.3"
autoflake = "^2.2.0"
pytest-xdist = { extras = ["psutil"], version = "^3.3.1" }
pytest-cov = "^4.1.0"
types-tzlocal = "^5.0.1.1"
ipykernel = "^6.25.0"
twine = "^4.0.2"
docutils = "0.20.1"
typing-extensions = "^4.11.0"
[tool.poetry.group.docs]
optional = true
[tool.poetry.group.docs.dependencies]
mkdocs = "^1.5.2"
mkdocs-material = "^9.1.21"
mkdocstrings = { extras = ["python"], version = ">=0.22,<0.25" }
mkdocs-literate-nav = "^0.6.0"
mkdocs-macros-plugin = "^1.0.2"
mkdocs-gen-files = "^0.5.0"
pygments = "^2.15.1"
pymdown-extensions = "^10.3"
mike = "^1.1.2"
black = "^24.4.0"
[tool.poetry.extras]
language_server = ["pygls", "lsprotocol"]
svg = ["drawsvg"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
pygerber = "pygerber.__main__:main"
pygerber_language_server = "pygerber.gerberx3.language_server.__main__:main"
[tool.poe.tasks]
# -------------------------------------------------------------------------------------
# git hooks
install-hooks = [
{ cmd = "poetry install --sync --with=docs --extras=language-server --extras=svg --no-ansi" },
{ cmd = "poetry run python -m scripts.install_hooks" },
{ cmd = "poetry run pre-commit install --install-hooks --overwrite" },
]
# -------------
# hook triggers
run-code-quality-checks = [
{ cmd = "poetry install --sync --with=docs --extras=language-server --extras=svg --no-ansi" },
{ cmd = "poetry run pre-commit run --all-files -v" },
]
# -------------------------------------------------------------------------------------
run-unit-tests = [
{ cmd = "poetry install --sync --with=docs --extras=language-server --extras=svg --no-ansi" },
{ cmd = "poetry run pytest --log-level=DEBUG -s -n logical --cov=pygerber --cov-report=term-missing:skip-covered" },
]
run-type-checks = [
{ cmd = "poetry install --sync --with=docs --extras=language-server --extras=svg --no-ansi" },
{ cmd = "poetry run mypy --config-file=pyproject.toml src/pygerber/ test/" },
]
[tool.ruff]
lint.select = ["ALL"]
lint.ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
"ANN101", # Missing type annotation for {name} in method
"ANN102", # Missing type annotation for {name} in classmethod
"D203", # 1 blank line required before class docstring
"D205", # 1 blank line required between summary line and description
"D213", # Multi-line docstring summary should start at the second line
"UP007", # Use X | Y for type annotations
"UP006", # Checks for the use of generics that can be replaced with standard library variants based on PEP 585.
"TCH001", # Checks for first-party imports that are only used for type annotations, but aren't defined in a type-checking block.
"D105", # Adding docstrings in all magic methods doesn't make sense, as usually they are just boilerplate to support operators.
"FIX002", # Line contains TODO, consider resolving the issue
"D107", # Adding docstring to __init__ doesn't make sense when class already has its docstring.
"ISC001", # Checks for the absence of trailing commas. Conflicts with ruff format.
"COM812", # Checks for implicitly concatenated strings on a single line. Conflicts with ruff format.
]
show-fixes = true
target-version = "py38"
src = ["src", "test"]
[tool.ruff.lint.pylint]
max-args = 8
[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]
[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"
[tool.ruff.lint.flake8-type-checking]
runtime-evaluated-base-classes = [
"pydantic.BaseModel",
"FrozenGeneralModel",
"BaseModel",
]
[tool.ruff.format]
# Enable reformatting of code snippets in docstrings.
docstring-code-format = true
# Use `\n` line endings for all files
line-ending = "lf"
[tool.mypy] # ANCHOR: tool.mypy
# ---------------------------------------------------------------------------- #
# https://mypy.readthedocs.io/en/stable/config_file.html #
# https://mypy.readthedocs.io/en/stable/command_line.html #
# https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html #
# ---------------------------------------------------------------------------- #
python_version = "3.8"
# A regular expression that matches file names, directory names and paths which
# mypy should ignore while recursively discovering files to check. Use forward
#slashes (/) as directory separators on all platforms.
exclude = ["external/", ".tox/", ".venv/", ".vscode/", "docs/", "scripts/"]
# ---------------------------------------------------------------------------- #
# Import discovery #
# ---------------------------------------------------------------------------- #
# Suppresses error messages about imports that cannot be resolved.
ignore_missing_imports = true
# Directs what to do with imports when the imported module is found as a .py file
# and not part of the files, modules and packages provided on the command line.
# The four possible values are normal, silent, skip and error. For explanations
# see the discussion for the --follow-imports command line flag.
follow_imports = "normal"
# Enables reporting error messages generated within installed packages (see
# :pep:`561` for more details on distributing type information). Those error
# messages are suppressed by default, since you are usually not able to
# control errors in 3rd party code.
no_silence_site_packages = false
# This flag tells mypy that top-level packages will be based in either the current
# directory, or a member of the MYPYPATH environment variable or mypy_path config
# option. This option is only useful in the absence of __init__.py. See Mapping file
# paths to modules for details.
explicit_package_bases = false
# ---------------------------------------------------------------------------- #
# Disallow dynamic typing #
# ---------------------------------------------------------------------------- #
# Disallows usage of types that come from unfollowed imports (anything imported from
# an unfollowed import is automatically given a type of ``Any``).
disallow_any_unimported = false
# Disallows all expressions in the module that have type ``Any``.
disallow_any_expr = false
# Disallows functions that have ``Any`` in their signature after decorator transformation.
disallow_any_decorated = false
# Disallows explicit ``Any`` in type positions such as type annotations and generic
# type parameters.
disallow_any_explicit = false
# Disallows usage of generic types that do not specify explicit type parameters.
disallow_any_generics = false
# Disallows subclassing a value of type ``Any``.
disallow_subclassing_any = false
# ---------------------------------------------------------------------------- #
# Untyped definitions and calls #
# ---------------------------------------------------------------------------- #
# Disallows calling functions without type annotations from functions with type
# annotations.
disallow_untyped_calls = false
# Disallows defining functions without type annotations or with incomplete type
# annotations.
disallow_untyped_defs = true
# Disallows defining functions with incomplete type annotations.
disallow_incomplete_defs = true
# Type-checks the interior of functions without type annotations.
check_untyped_defs = true
# Reports an error whenever a function with type annotations is decorated with a
# decorator without annotations.
disallow_untyped_decorators = false
# ---------------------------------------------------------------------------- #
# None and Optional handling #
# ---------------------------------------------------------------------------- #
# Changes the treatment of arguments with a default value of ``None`` by not implicitly
# making their type :py:data:`~typing.Optional`.
no_implicit_optional = true
# Enables or disables strict Optional checks. If False, mypy treats ``None``
# as compatible with every type.
strict_optional = true
# ---------------------------------------------------------------------------- #
# Warnings #
# ---------------------------------------------------------------------------- #
# warns about casting an expression to its inferred type.
warn_redundant_casts = true
# Warns about unneeded ``# type: ignore`` comments.
warn_unused_ignores = false
# Shows errors for missing return statements on some execution paths.
warn_no_return = true
# Shows a warning when returning a value with type ``Any`` from a function
# declared with a non- ``Any`` return type.
warn_return_any = true
# Shows a warning when encountering any code inferred to be unreachable or
# redundant after performing type analysis.
warn_unreachable = true
# ---------------------------------------------------------------------------- #
# Miscellaneous strictness flags #
# ---------------------------------------------------------------------------- #
# Causes mypy to suppress errors caused by not being able to fully
# infer the types of global and class variables.
allow_untyped_globals = false
# Allows variables to be redefined with an arbitrary type, as long as the redefinition
# is in the same block and nesting level as the original definition.
# Example where this can be useful:
allow_redefinition = true
# Disallows inferring variable type for ``None`` from two assignments in different scopes.
# This is always implicitly enabled when using the :ref:`mypy daemon <mypy_daemon>`.
local_partial_types = false
# By default, imported values to a module are treated as exported and mypy allows
# other modules to import them. When false, mypy will not re-export unless
# the item is imported using from-as or is included in ``__all__``. Note that mypy
# treats stub files as if this is always disabled. For example:
no_implicit_reexport = false
# Prohibit equality checks, identity checks, and container checks between
# non-overlapping types.
strict_equality = true
# ---------------------------------------------------------------------------- #
# https://mypy.readthedocs.io/en/stable/error_codes.html#error-codes #
# ---------------------------------------------------------------------------- #
# Allows disabling one or multiple error codes globally.
# disable_error_code =
# Allows enabling one or multiple error codes globally.
enable_error_code = "redundant-expr"
# ---------------------------------------------------------------------------- #
# Configuring error messages #
# ---------------------------------------------------------------------------- #
# Prefixes each error with the relevant context.
show_error_context = true
# Shows column numbers in error messages.
show_column_numbers = true
# hows error codes in error messages. See :ref:`error-codes` for more information.
show_error_codes = true
# Use visually nicer output in error messages: use soft word wrap,
# show source code snippets, and show error location markers.
pretty = true
# Shows error messages with color enabled.
color_output = true
# Shows a short summary line after error messages.
error_summary = true
# Show absolute paths to files.
show_absolute_path = true