-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyproject.toml
317 lines (280 loc) · 10.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
314
315
316
317
[tool.poetry]
name = "mcproto"
version = "0.0.1" # Versioning handled by poetry-dynamic-versioning
description = "Library providing easy interactions with minecraft servers"
authors = ["ItsDrike <[email protected]>"]
license = "LGPL-3.0-or-later"
readme = "README.md"
repository = "https://github.com/py-mine/mcproto"
documentation = "https://mcproto.readthedocs.io/"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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 :: Games/Entertainment",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Networking",
"Typing :: Typed",
]
include = ["CHANGELOG.md"]
packages = [{ include = "mcproto" }]
[tool.poetry.dependencies]
python = ">=3.9,<4"
asyncio-dgram = "^2.1.2"
typing-extensions = "^4.4.0"
httpx = "^0.24.1"
cryptography = ">=41.0.3,<44.0.0"
attrs = ">=23.2,<25.0"
packaging = "^24.2"
[tool.poetry.group.dev.dependencies]
pre-commit = ">=2.18.1,<5.0.0"
taskipy = "^1.10.4"
[tool.poetry.group.test.dependencies]
pytest = "^7.3.1"
pytest-asyncio = ">=0.21,<0.24"
pytest-cov = ">=3,<7"
pytest-httpx = { version = ">=0.23.1,<0.25.0", python = ">=3.9,<4" }
[tool.poetry.group.lint.dependencies]
ruff = ">=0.5.0"
slotscheck = ">=0.16.1,<0.20.0"
basedpyright = "^1.13.3"
[tool.poetry.group.release.dependencies]
towncrier = ">=23,<24.7" # temporary pin, as 24.7 is incompatible with sphinxcontrib-towncrier
[tool.poetry.group.release-ci]
optional = true
[tool.poetry.group.release-ci.dependencies]
poetry-dynamic-versioning = ">=1.4.0,<1.6"
[tool.poetry.group.docs.dependencies]
sphinx = ">=6.2.1,<8.0.0"
tomli = { version = "^2.0.1", python = "<3.11" }
m2r2 = "^0.3.3.post2"
packaging = ">=23.1,<25.0"
sphinx-autodoc-typehints = ">=1.23,<3.0"
sphinx-copybutton = "^0.5.2"
furo = ">=2022.12.7"
sphinxcontrib-towncrier = ">=0.3.2,<0.5.0"
pytest = "^7.3.1" # Required to import the gen_test_serializable function to list it in the docs
[tool.poetry.group.docs-ci]
optional = true
[tool.poetry.group.docs-ci.dependencies]
poetry-dynamic-versioning = ">=1.4.0,<1.6"
taskipy = "^1.10.4"
[tool.basedpyright]
pythonPlatform = "All"
pythonVersion = "3.9"
typeCheckingMode = "all"
# Diagnostic behavior settings
strictListInference = false
strictDictionaryInference = false
strictSetInference = false
analyzeUnannotatedFunctions = true
strictParameterNoneValue = true
enableTypeIgnoreComments = true
deprecateTypingAliases = true # only applies for python 3.9+
enableExperimentalFeatures = false
disableBytesTypePromotions = true
# Diagnostic rules
reportAny = false
reportExplicitAny = false
reportImplicitStringConcatenation = false
reportUnreachable = "hint"
reportUnusedParameter = "hint"
reportUnannotatedClassAttribute = false
reportUnknownArgumentType = false # consider enabling
reportUnknownVariableType = false # consider enabling
reportUnknownMemberType = false # consider enabling
reportUnknownParameterType = false # consider enabling
reportUnknownLambdaType = false # consider enabling
reportMissingTypeStubs = "information" # consider bumping to warning/error
reportUninitializedInstanceVariable = false # until https://github.com/DetachHead/basedpyright/issues/491
reportMissingParameterType = false # ruff's flake8-annotations (ANN) already covers this + gives us more control
[tool.ruff]
target-version = "py39"
line-length = 119
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"C90", # mccabe
"FBT", # flake8-boolean-trap
"CPY", # flake8-copyright
"EM", # flake8-errmsg
"SLF", # flake8-self
"ARG", # flake8-unused-arguments
"TD", # flake8-todos
"FIX", # flake8-fixme
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in __init__
"D203", # Blank line required before class docstring
"D213", # Multi-line summary should start at second line (incompatible with D212)
"D301", # Use r""" if any backslashes in a docstring
"D405", # Section name should be properly capitalized
"D406", # Section name should end with a newline
"D407", # Missing dashed underline after section
"D408", # Section underline should be in the line following the section's name
"D409", # Section underline should match the length of its name
"D410", # Missing blank line after section
"D411", # Missing blank line before section
"D412", # No blank lines allowed between a section header and its content
"D413", # Missing blank line after last section
"D414", # Section has no content
"D416", # Section name should end with a colon
"D417", # Missing argument descrition in the docstring
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"ANN204", # Missing return type annotation for special method
"ANN401", # Dynamically typed expressions (typing.Any) disallowed
"SIM102", # use a single if statement instead of nested if statements
"SIM108", # Use ternary operator {contents} instead of if-else-block
"TC001", # Move application imports used only for annotations into a type-checking block
"TC002", # Move 3rd-party imports used only for annotations into a type-checking block
"TC003", # Move standard library imports used only for annotations into a type-checking block
"TD002", # Missing author in TODO
"TD003", # Missing issue link on the line following this TODO
"PT011", # pytest.raises without match parameter is too broad # TODO: Unignore this
"TRY003", # No f-strings in raise statements
"EM101", # No string literals in exception init
"EM102", # No f-strings in exception init
"UP024", # Using errors that alias OSError
"PLR2004", # Using unnamed numerical constants
"PGH003", # Using specific rule codes in type ignores
"E731", # Don't asign a lambda expression, use a def
# Redundant rules with ruff-format:
"E111", # Indentation of a non-multiple of 4 spaces
"E114", # Comment with indentation of a non-multiple of 4 spaces
"E117", # Cheks for over-indented code
"D206", # Checks for docstrings indented with tabs
"D300", # Checks for docstring that use ''' instead of """
"Q000", # Checks of inline strings that use wrong quotes (' instead of ")
"Q001", # Multiline string that use wrong quotes (''' instead of """)
"Q002", # Checks for docstrings that use wrong quotes (''' instead of """)
"Q003", # Checks for avoidable escaped quotes ("\"" -> '"')
"COM812", # Missing trailing comma (in multi-line lists/tuples/...)
"COM819", # Prohibited trailing comma (in single-line lists/tuples/...)
"ISC001", # Single line implicit string concatenation ("hi" "hey" -> "hihey")
"ISC002", # Multi line implicit string concatenation
]
[tool.ruff.lint.extend-per-file-ignores]
"tests/*" = [
"ANN", # flake8-annotations
"S101", # Use of assert
]
"docs/conf.py" = [
"INP", # allow implicit namespace (pep 420)
]
"docs/extensions/*" = [
"D", # pydocstyle
"INP", # allow implicit namespace (pep 420)
]
".github/scripts/*" = [
"D", # pydocstyle
"INP", # allow implicit namespace (pep 420)
]
[tool.ruff.lint.isort]
order-by-type = false
case-sensitive = true
combine-as-imports = true
# Redundant rules with ruff-format
force-single-line = false # forces all imports to appear on their own line
force-wrap-aliases = false # Split imports with multiple members and at least one alias
lines-after-imports = -1 # The number of blank lines to place after imports
lines-between-types = 0 # Number of lines to place between "direct" and import from imports
split-on-trailing-comma = false # if last member of multiline import has a comma, don't fold it to single line
[tool.ruff.lint.pylint]
max-args = 20
max-branches = 20
max-returns = 20
max-statements = 250
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.format]
line-ending = "lf"
[tool.pytest.ini_options]
minversion = "6.0"
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = "--strict-markers --cov --no-cov-on-fail"
[tool.coverage.report]
precision = 2
fail_under = 20
show_missing = true
skip_covered = false
skip_empty = false
sort = "cover"
exclude_lines = [
"\\#\\s*pragma: no cover",
"^\\s*if (typing\\.)?TYPE_CHECKING:",
"^\\s*@(abc\\.)?abstractmethod",
"^\\s*@(typing\\.)?overload",
"^\\s*def __repr__\\(",
"^\\s*class .*\\bProtocol\\):",
"^\\s*raise NotImplementedError",
"^\\s*return NotImplemented",
"^\\s*\\.\\.\\.",
]
[tool.coverage.run]
relative_files = true
parallel = true
branch = true
timid = false
source = ["mcproto"]
[tool.towncrier]
package = "mcproto"
directory = "changes"
template = "changes/.template.rst"
ignore = [".template.rst"]
filename = "CHANGELOG.md"
issue_format = "[#{issue}](https://github.com/py-mine/mcproto/issues/{issue})"
orphan_prefix = "+" # Use '+' instead of number for fragments not connected to any PR
underlines = [2, 3] # We use this for heading levels (see template file)
type = [
{ name = "Breaking Changes", directory = "breaking", showcontent = true },
{ name = "Deprecation", directory = "deprecation", showcontent = true },
{ name = "Features", directory = "feature", showcontent = true },
{ name = "Bugfixes", directory = "bugfix", showcontent = true },
{ name = "Documentation Improvements", directory = "docs", showcontent = true },
{ name = "Internal Changes", directory = "internal", showcontent = true },
]
[tool.slotscheck]
strict-imports = true
require-superclass = true
require-subclass = true
exclude-modules = '''
(
^test # ignore any tests
|^.github/scripts # Ignore any CI scripts
|^mcproto\.utils\.version # Dataclasses below python 3.10 don't support __slots__ due to default value fields being treated as classvars.
)
'''
[tool.taskipy.tasks]
precommit = "pre-commit install"
lint = "pre-commit run --all-files"
basedpyright = "basedpyright --warnings ."
ruff = "ruff check --fix ."
ruff-format = "ruff format ."
slotscheck = "slotscheck -m mcproto"
test = "pytest -v --failed-first"
retest = "pytest -v --last-failed"
test-nocov = "pytest -v --no-cov --failed-first"
retest-nocov = "pytest -v --no-cov --last-failed"
changelog-preview = "towncrier build --draft --version next"
docs = "sphinx-build -b dirhtml -d ./docs/_build/doctrees -W -E -T --keep-going ./docs ./docs/_build/html"
[tool.poetry-dynamic-versioning]
enable = true
bump = true
vcs = "git"
style = "pep440"
[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry.core.masonry.api"