-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathpyproject.toml
300 lines (274 loc) · 8.33 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
[build-system]
requires = ["build", "setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"
[project]
name = "cmd2"
dynamic = ["version"]
description = "cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python"
authors = [{ name = "cmd2 Contributors" }]
readme = "README.md"
requires-python = ">=3.8"
keywords = ["CLI", "cmd", "command", "interactive", "prompt", "Python"]
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"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 :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"gnureadline; platform_system == 'Darwin'",
"pyperclip",
"pyreadline3; platform_system == 'Windows'",
"wcwidth",
]
[project.optional-dependencies]
build = ["build", "setuptools", "setuptools-scm"]
dev = [
"black",
"codecov",
"griffe-typingdoc",
"invoke",
"mkdocs-include-markdown-plugin",
"mkdocs-macros-plugin",
"mkdocs-material",
"mkdocstrings[python]",
"mypy",
"pytest",
"pytest-cov",
"pytest-mock",
"ruff",
"twine",
]
docs = [
"black",
"griffe-typingdoc",
"mkdocs-include-markdown-plugin",
"mkdocs-macros-plugin",
"mkdocs-material",
"mkdocstrings[python]",
"setuptools",
"setuptools_scm",
]
test = ["codecov", "coverage", "pytest", "pytest-cov", "pytest-mock"]
validate = ["mypy", "ruff", "types-setuptools"]
[tool.mypy]
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
exclude = [
"^build/", # .build directory
"^docs/", # docs directory
"^examples/", # examples directory
"^plugins/*", # plugins directory
"^noxfile\\.py$", # nox config file
"setup\\.py$", # any files named setup.py
"^tasks\\.py$", # tasks.py invoke config file
"^tests/", # tests directory
"^tests_isolated/", # tests_isolated directory
]
show_column_numbers = true
show_error_codes = true
show_error_context = true
strict = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_ignores = false
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = [
"--cov=cmd2",
"--cov-append",
"--cov-report=term",
"--cov-report=html",
]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Same as Black.
line-length = 127
indent-width = 4
# Assume Python 3.13
target-version = "py313"
output-format = "full"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = [
# https://beta.ruff.rs/docs/rules
# "A", # flake8-builtins
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
# "B", # flake8-bugbear
# "BLE", # flake8-blind-except
# "C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
# "COM", # flake8-commas
# "D", # pydocstyle
"DJ", # flake8-django
# "DTZ", # flake8-datetimez
"E", # pycodestyle
# "EM", # flake8-errmsg
# "ERA", # eradicate
# "EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
# "FBT", # flake8-boolean-trap
"G", # flake8-logging-format
# "I", # isort
"ICN", # flake8-import-conventions
# "INP", # flake8-no-pep420
"INT", # flake8-gettext
# "ISC", # flake8-implicit-str-concat
# "N", # pep8-naming
"NPY", # NumPy-specific rules
"PD", # pandas-vet
# "PGH", # pygrep-hooks
# "PIE", # flake8-pie
# "PL", # Pylint
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "PYI", # flake8-pyi
# "RET", # flake8-return
"RSE", # flake8-raise
# "Q", # flake8-quotes
# "RUF", # Ruff-specific rules
# "S", # flake8-bandit
# "SIM", # flake8-simplify
# "SLF", # flake8-self
# "T10", # flake8-debugger
# "T20", # flake8-print
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
# "TID", # flake8-tidy-imports
# "TRY", # tryceratops
# "UP", # pyupgrade
# "W", # pycodestyle
# "YTT", # flake8-2020
]
ignore = [
# `ruff rule S101` for a description of that rule
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
"E501", # Line too long
"EM101", # Exception must not use a string literal, assign to variable first
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
"G004", # Logging statement uses f-string
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
"PT018", # Assertion should be broken down into multiple parts
"S101", # Use of `assert` detected -- DO NOT FIX
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)` -- DO NOT FIX
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
mccabe.max-complexity = 49
per-file-ignores."cmd2/__init__.py" = [
"E402", # Module level import not at top of file
"F401", # Unused import
]
per-file-ignores."docs/conf.py" = [
"F401", # Unused import
]
per-file-ignores."examples/override_parser.py" = [
"E402", # Module level import not at top of file
]
per-file-ignores."examples/scripts/*.py" = [
"F821", # Undefined name `app`
]
per-file-ignores."tests/pyscript/*.py" = [
"F821", # Undefined name `app`
]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "preserve"
# 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"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[tool.setuptools]
packages = ["cmd2"]
[tool.setuptools_scm]
[tool.uv]
dev-dependencies = [
"black",
"build",
"cmd2-ext-test",
"codecov",
"griffe-typingdoc",
"invoke",
"mkdocs-include-markdown-plugin",
"mkdocs-macros-plugin",
"mkdocs-material",
"mkdocstrings[python]",
"mypy",
"pytest",
"pytest-cov",
"pytest-mock",
"ruff",
"ruff",
"twine",
]
[tool.uv.sources]
cmd2-ext-test = { path = "plugins/ext_test", editable = true }