-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
214 lines (188 loc) · 7.31 KB
/
pyproject.toml
File metadata and controls
214 lines (188 loc) · 7.31 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
[build-system]
requires = [ "hatchling (>=1.27.0,<2.0.0)", "uv-dynamic-versioning (>=0.11.1,<1.0.0)" ]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = [ "src/uciparse" ]
[tool.hatch.build.targets.sdist]
only-include = [ "Changelog", "README.md", "docs", "src", "scripts" ]
exclude = [ "docs/_build" ]
[project]
name = "uciparse"
requires-python = ">=3.11,<4"
description = "Parse and emit OpenWRT uci-format files"
authors = [ { name="Kenneth J. Pronovici", email="pronovic@ieee.org" } ]
license = "Apache-2.0"
license-files = [ "LICENSE", "NOTICE" ]
readme = "PyPI.md"
dynamic = [ "version" ]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Environment :: Console",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"Topic :: System :: Systems Administration",
]
dependencies = [
]
[project.urls]
Homepage = "https://pypi.org/project/uciparse/"
Repository = "https://github.com/pronovic/uci-parse"
Changelog = "https://github.com/pronovic/uci-parse/releases"
Documentation = "https://uci-parse.readthedocs.io/en/stable/"
Issues = "https://github.com/pronovic/uci-parse/issues"
[project.optional-dependencies]
docs = [
"sphinx (>=8.1.3,<9.0.0)", # newer versions of Sphinx require Python 3.11
"sphinx-autoapi (>=3.3.3,<4.0.0)",
]
[dependency-groups]
dev = [
"ruff (>=0.12.10,<1.0.0)",
"pytest (>=9.0.3,<10.0.0)",
"pytest-testdox (>=3.1.0,<4.0.0)",
"pytest-cov (>=7.1.0,<8.0.0)",
"prek (>=0.2.1,<1.0.0)",
"mypy (>=1.6.0,<2.0.0)",
"colorama (>=0.4.6,<1.0.0)",
]
[project.scripts]
uciparse = "uciparse.cli:parse"
ucidiff = "uciparse.cli:diff"
[tool.hatch.version]
source = "uv-dynamic-versioning"
[tool.uv]
required-version = ">=0.8.18,<1.0.0"
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true }}]
# Published version is managed using Git tags
# We get either the tag (like "0.24.1") or a snapshot-type version (like "0.24.1+3.e8319c4")
[tool.uv-dynamic-versioning]
fallback-version = "0.0.0"
pattern = '^[vV](?P<base>\d+\.\d+\.\d+)' # this extracts the version from our vX.Y.Z tag format
format-jinja = "{% if distance == 0 and not dirty %}{{ base }}{% else %}{{ base }}+{{ distance }}.{{ commit }}{% endif %}"
[tool.coverage.paths]
source = [ "src" ]
[tool.coverage.run]
branch = true
source = [ "src/uciparse" ]
[tool.coverage.report]
show_missing = false
precision = 0
omit = [ "src/tests/*" ]
[tool.pytest]
strict = true
filterwarnings = [
'error', # turn all Python warnings into test failures, so they're hard to miss
]
[tool.ruff]
src = ["src"]
extend-exclude = [ "docs", "notes" ]
line-length = 132
preview = true
[tool.ruff.format]
quote-style = "double"
line-ending = "lf"
docstring-code-format = true
docstring-code-line-length = 80
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
parametrize-names-type = "csv"
parametrize-values-type = "list"
parametrize-values-row-type = "list"
# Note: requires TID251 to be selected below
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"conftest".msg = "use 'tests.conftest' instead"
"unittest.TestCase".msg = "use pytest, not unittest"
[tool.ruff.lint]
select = [
# Start with all Ruff linter rules, and exclude some specific rules and categories (see below)
"ALL"
]
ignore = [
# Ruff-recommended exclusions, not needed because we're using the Ruff formatter
"COM812", # missing-trailing-comma
"COM819", # prohibited-trailing-comma
"D206", # docstring-tab-indentation
"D300", # triple-single-quotes
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"E501", # line-too-long
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"W191", # tab-indentation
# Exclusions of entire rule categories, standardized across all of my repos
"C90", # mccabe cyclomatic complexity
"CPY", # flake8-copyright
"D", # pydocstyle
"DJ", # flake8-django
"DOC", # pydoclint
"EXE", # flake8-executable
"FIX", # flake8-fixme
"TD", # flake8-todo
# Exclusions of specific rules, standardized across all of my repos
"ANN401", # allow dynamically typed expressions using `typing.Any`
"EM101", # allow raw string messages in exceptions; having to pull out a variable makes code harder to read
"EM102", # allow f-string messages in exceptions; having to pull out a variable makes code harder to read
"FURB140", # don't automatically convert generator expressions to use `itertools.starmap()`
"PGH004", # allow `# noqa` with no error code; sometimes this is needed to prevent unwanted magical auto-fixes
"PLR2004", # allow magic numbers; using a constant doesn't necessarily make a magic number any more legible
"PT011", # allow `pytest.raises` for any exception type; this is often a false-positive that has little benefit
"PT018", # allow `assert` with multiple conditions; ruff suggestions often make the code less legible
"PT019", # allow unused PyTest fixtures; this check has a lot of false positives for `@unittest.mock.patch()`
"S101", # allow use of `assert`; we sometimes use assert as a type hint for MyPy, and do not run with -O
"S404", # allow use of `subprocess`; it's a common way to run shell commands, and this check is overly paranoid
"SIM102", # allow nested `if` clauses; ruff suggestions often make the code less legible
"SIM117", # allow nested `with` clauses; ruff suggestions often make the code less legible
"TRY003", # allow long messages in exceptions; this is often a false-positive that has little benefit
]
[tool.ruff.lint.per-file-ignores]
"src/tests/**/*" = [
# Exclusions that apply to unit tests only
"ANN", # don't require type annotations in tests
"FBT", # allow use of boolean positional arguments
"PLC1901", # allow comparison to empty string
"PLC2701", # allow imports of private names
"PLR", # don't warn about too many arguments, methods, etc.
"SLF001", # allow access to private members
]
[tool.mypy]
files = [ "src" ]
pretty = true
show_absolute_path = true
show_column_numbers = true
show_error_codes = true
# Settings equivalent to strict=true as of v1.17.1
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = false
disallow_untyped_defs = true
extra_checks = true
no_implicit_reexport = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
warn_unused_ignores = true
# Additional settings above and beyond strict=true
implicit_optional = false
strict_optional = true
warn_no_return = true
warn_unreachable = true
# It's hard to make tests compliant using unittest.mock
[[tool.mypy.overrides]]
module = "tests.*"
check_untyped_defs = false
disallow_untyped_defs = false