-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathpyproject.toml
More file actions
287 lines (248 loc) · 9.06 KB
/
Copy pathpyproject.toml
File metadata and controls
287 lines (248 loc) · 9.06 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
[project]
name = "mcstatus"
dynamic = ["version"]
license = "Apache-2.0"
description = "A library to query Minecraft Servers for their status and capabilities."
readme = "README.md"
authors = [
{ name = "Nathan Adams", email = "dinnerbone@dinnerbone.com" },
{ name = "ItsDrike", email = "itsdrike@protonmail.com" },
{ name = "PerchunPak", email = "perchunpak@gmail.com" },
]
maintainers = [
{ name = "Kevin Tindall", email = "kevinkjt2000@gmail.com" },
{ name = "ItsDrike", email = "itsdrike@protonmail.com" },
{ name = "PerchunPak", email = "perchunpak@gmail.com" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Games/Entertainment",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Monitoring",
"Typing :: Typed",
]
keywords = ["minecraft", "protocol"]
requires-python = ">=3.10"
dependencies = ["asyncio-dgram>=2.1.2", "dnspython>=2.4.2"]
[project.urls]
Documentation = "https://mcstatus.readthedocs.io"
"Source code" = "https://github.com/py-mine/mcstatus"
[tool.uv]
default-groups = ["dev", "lint", "test", "docs"]
[dependency-groups]
dev = ["poethepoet~=0.46.0"]
lint = [
"pre-commit~=4.6.0",
"ruff~=0.15.0",
"basedpyright~=1.39.2",
"typing-extensions~=4.15.0",
]
test = [
"pytest~=9.1.0",
"pytest-asyncio~=1.4.0",
"pytest-cov~=7.1.0",
"pytest-rerunfailures~=16.1",
"coverage~=7.14.0",
"typing-extensions~=4.15.0",
# the actual versions are in the `release` group
"uv-dynamic-versioning",
"hatchling",
]
docs = ["docs; python_version >= '3.12'"]
release = ["hatchling~=1.30.1", "uv-dynamic-versioning~=0.14.0"]
[tool.poe.tasks]
_lint_ruff = "ruff check ."
_lint_pyright = "basedpyright ."
[tool.poe.tasks.build]
cmd = "uv build"
help = "Builds the whl and tar.gz distributions"
[tool.poe.tasks.docs]
cmd = "make -C docs/ html"
help = "Generates documentation locally in html format"
[tool.poe.tasks.format]
cmd = "ruff format"
help = "Runs automatic formatting tools"
[tool.poe.tasks.lint]
sequence = ["_lint_pyright", "_lint_ruff"]
help = "Runs linter tools"
[tool.poe.tasks.pre-commit]
cmd = "pre-commit run --all-files"
help = "Executes commit hook checks on all files"
[tool.poe.tasks.release]
cmd = "uv publish"
deps = ["pre-commit", "test", "build"]
help = "Requires all the checks to pass before building and publishing"
[tool.poe.tasks.test]
cmd = "pytest"
help = "Runs the unit tests"
[tool.pytest.ini_options]
minversion = "6.0"
asyncio_mode = "auto"
tmp_path_retention_policy = "failed"
addopts = "--strict-markers --doctest-modules --cov -vvv"
testpaths = ["tests"]
# Remove deprecation warning
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.report]
precision = 2 # number of decimal places
fail_under = 80
show_missing = true
skip_covered = false
skip_empty = false
sort = "cover"
exclude_lines = [
"\\#\\s*pragma: no cover",
"^\\s*if (t|typing\\.)?TYPE_CHECKING:",
"^\\s*@(t|typing\\.)?overload",
"^\\s*@(abc\\.)?abstractmethod",
"^\\s*def __repr__\\(",
"^\\s*class .*\\bProtocol\\):",
"^\\s*raise NotImplementedError",
"^\\s*return NotImplemented",
"^\\s*\\.\\.\\.\\s",
"^\\s*if __name__ == \"__main__\":",
]
[tool.coverage.run]
relative_files = true
parallel = true
branch = true
timid = false
source = ["mcstatus"]
[tool.basedpyright]
pythonPlatform = "All"
pythonVersion = "3.10"
typeCheckingMode = "all"
# Diagnostic behavior settings
strictListInference = false
strictDictionaryInference = false
strictSetInference = false
strictParameterNoneValue = true
analyzeUnannotatedFunctions = true
enableTypeIgnoreComments = false
enableExperimentalFeatures = false
# Diagnostic rules
reportAny = false
reportExplicitAny = false
reportImplicitStringConcatenation = false
reportUnreachable = "hint"
reportUnusedParameter = "hint"
reportUnannotatedClassAttribute = true # might be too strict
reportUnknownVariableType = true # might be too strict
reportUnknownMemberType = true # might be too strict
reportUnknownArgumentType = true # might be too strict
reportUnknownParameterType = true # might be too strict
reportUnknownLambdaType = false
reportMissingTypeStubs = "information"
reportMissingParameterType = false # ruff's flake8-annotations (ANN) already covers this + gives us more control
reportIncompatibleUnannotatedOverride = false # https://github.com/DetachHead/basedpyright/issues/1349
reportUninitializedInstanceVariable = false # consider enabling
executionEnvironments = [
{ root = "tests", extraPaths = ["."], reportPrivateUsage = false },
{ root = "docs/examples", extraPaths = ["."], reportUnusedCallResult = false }
]
[tool.ruff]
target-version = "py310"
line-length = 127
[tool.ruff.lint]
select = ["ALL"]
preview = true
ignore = [
"EM", # Very weird rules for using exceptions
"FIX", # Line contains TODO, consider resolving the issue
"CPY001", # Missing copyright notice at top of file
"COM812", # Missing trailing comma (in multiline lists/tuples/...)
"PLR2004", # Magic value used in comparison
"RET504", # Unnecessary assignment to a variable before `return` statement
"S101", # Use of `assert` detected
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"TD002", # Missing author in TODO
"TD003", # Missing issue link for this TODO
"TRY003", # Avoid specifying long messages outside the exception class
"ISC002", # Multi line implicit string concatenation
"PLC1901", # Explicit comparison against empty string (already falsy)
"PLR6301", # Method could be a function, class method, or static method -> https://github.com/astral-sh/ruff/issues/24713
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D203", # Blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D413", # Missing blank line after last section
"DOC201", # Return is not documented in docstring
"DOC402", # Yield not documented in docstring
"DOC501", # Raised exception missing from docstring
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"ANN", # flake8-annotations
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"FBT001", # Boolean-typed positional argument in function definition
"SLF001", # Private member accessed
"T201", # Usage of `print`
"PLC2701", # Private name import from external module (mcstatus is external to tests/)
"PLR6301", # Method could be a function, class method, or static method
"PLR0904", # Too many public methods
"RUF067", # __init__ module should only contain docstrings and re-exports
]
"docs/**" = [
"INP001", # Implicit namespace package
]
"docs/examples/code/**" = [
"FA", # flake8-future-annotations
"BLE001", # Do not catch blind exception: `Exception`
"T201", # Usage of `print`
"TC001", # Move application import into a type-checking block
]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
banned-module-level-imports = ["typing_extensions"]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"mcstatus._compat".msg = "Deprecated compatibility shims should not be imported"
[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.flake8-annotations]
allow-star-arg-any = true
[tool.ruff.lint.pylint]
max-args = 10
[tool.ruff.lint.flake8-builtins]
ignorelist = ["id", "copyright"]
[tool.ruff.format]
line-ending = "lf"
[project.scripts]
mcstatus = "mcstatus.__main__:main"
[build-system]
requires = ["hatchling", "uv-dynamic-versioning"]
build-backend = "hatchling.build"
[tool.uv.sources]
docs = { path = "docs" }
[tool.hatch.version]
source = "uv-dynamic-versioning"
[tool.uv-dynamic-versioning]
metadata = false
fallback-version = "0.0.0"
[tool.hatch.build.targets.sdist.force-include]
"mcstatus/_compat/forge_data.py" = "mcstatus/forge_data.py"