-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathpyproject.toml
More file actions
462 lines (404 loc) · 11.5 KB
/
pyproject.toml
File metadata and controls
462 lines (404 loc) · 11.5 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
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# SPDX-License-Identifier: MIT
[build-system]
requires = ["hatchling>=1.27.0", "versioningit>=3.3.0,<4", "packaging"]
build-backend = "hatchling.build"
[project]
name = "disnake"
description = "A Python wrapper for the Discord API"
readme = "README.md"
authors = [
{ name = "Disnake Development" }
]
requires-python = ">=3.10"
keywords = ["disnake", "discord", "discord api"]
license = "MIT"
license-files = ["LICENSE"]
dependencies = [
"aiohttp>=3.7.0,<4.0",
"typing-extensions>=4.1",
"yarl>=1.0",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
# it is important that the python classifiers are sorted in the sequential order
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Internet",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
"Typing :: Typed",
]
dynamic = ["version"]
[project.urls]
Changelog = "https://docs.disnake.dev/page/whats_new.html"
Documentation = "https://docs.disnake.dev/"
Repository = "https://github.com/DisnakeDev/disnake"
[project.optional-dependencies]
speed = [
"orjson~=3.6",
"aiohttp[speedups]",
]
voice = [
"PyNaCl>=1.5.0,<1.7",
"dave.py~=0.1.1",
'audioop-lts>=0.2.1; python_version >= "3.13"',
]
[dependency-groups]
dev = [
{ include-group = "tools" },
{ include-group = "nox" },
{ include-group = "codemod" },
{ include-group = "typing" },
{ include-group = "test" },
{ include-group = "build" },
{ include-group = "docs" },
]
nox = [
# note: nox should be synced with nox.needs_version in noxfile.py
# and the pinned nox version in noxfile.py must be within these bounds
"nox>=2025.5.1",
]
ruff = [
"ruff==0.14.5",
]
tools = [
"prek>=0.2.0",
"slotscheck==0.19.1",
"check-wheel-contents~=0.6.3",
{ include-group = "ruff" },
]
changelog = [
"towncrier==23.6.0",
]
codemod = [
# run codemods on the repository (mostly automated typing)
"libcst==1.8.5",
"autotyping==24.9.0",
{ include-group = "ruff" },
]
typing = [
# this is not pyright itself, but the python wrapper
"pyright==1.1.405",
# all type-check only dependencies are defined in noxfile.py.
]
test = [
"pytest~=8.4.2",
"pytest-cov~=7.0",
"pytest-asyncio~=0.24.0",
"looptime~=0.2.0",
"coverage[toml]~=7.10.0",
]
build = [
"build>=1.2.2.post1",
"twine>=6.1.0",
"versioningit>=3.3.0,<4",
]
docs = [
"sphinx==7.0.1",
"docutils>=0.18.1",
"sphinxcontrib-trio~=1.1.2",
"sphinx-hoverxref==1.3.0",
"sphinx-autobuild~=2021.3",
"sphinxcontrib-towncrier==0.3.2a0",
"sphinx-notfound-page==0.8.3",
"sphinxext-opengraph==0.9.1",
"versioningit>=3.3.0,<4",
{ include-group = "changelog" },
]
[tool.uv]
required-version = ">=0.9.2"
[tool.hatch.build]
artifacts = ["disnake/_version.py"]
[tool.hatch.build.targets.sdist]
only-include = [
"disnake",
"scripts/versioning.py",
]
[tool.hatch.version]
source = "versioningit"
[tool.versioningit]
default-version = "0.0.0"
[tool.versioningit.vcs]
method = "git-archive"
describe-subst = "$Format:%(describe:tags,match=v*)$"
[tool.versioningit.format]
distance = "{base_version}a{distance}+{vcs}{rev}"
dirty = "{base_version}+d{build_date:%Y%m%d}"
distance-dirty = "{base_version}a{distance}+{vcs}{rev}.d{build_date:%Y%m%d}"
[tool.versioningit.template-fields]
method = { module = "scripts.versioning", value = "template_fields"}
[tool.versioningit.write]
file = "disnake/_version.py"
template = """
# SPDX-License-Identifier: MIT
from typing import Literal, NamedTuple
__version__ = "{version}"
class VersionInfo(NamedTuple):
major: int
minor: int
micro: int
releaselevel: Literal["alpha", "beta", "candidate", "final"]
serial: int
version_info: VersionInfo = VersionInfo{version_tuple}
"""
[tool.ruff]
line-length = 100
[tool.codespell]
skip = ['docs/_static/**', '*.po']
ignore-words-list = ['GroupT', "OT",]
[tool.ruff.lint]
future-annotations = true
select = ["ALL"]
ignore = [
## eradicate
"ERA", # most of our commented-out code is excluded
## flake8-annotations
"ANN0",
"ANN4",
## flake8-bandit
"S101", # use of assert is fine
"S311", # use of random is fine in most cases
"S603", # calling subprocess with dynamic arguments is generally fine, the only way to avoid this is ignoring it
"S607", # partial executable paths (i.e. "git" instead of "/usr/bin/git") are fine
"S110", # ignore try-except-pass. Bare excepts are caught with E722
## flake8-blind-except
"BLE", # similar to S110, but also flags Exception
## flake8-boolean-trap
"FBT", # at some point we should make booleans keyword only
## flake8-commas
"COM812", # mostly managed by the formatter
## flake8-fixme
"FIX", # TODO: what the name says!
## flake8-no-pep420
"INP001", # Ha.
## flake8-pie
"PIE790", # TODO: removes pass or ... when there is a docstring
## flake8-print
"T201", # TODO: disabled until the library configures logging
## flake8-pyi
"PYI", # TODO: enable, in separate PR (most have autofixes)
## flake8-return
"RET505", "RET506", # not likely to be enabled
## flake8-self
"SLF", # private member access, this is unlikely to be enabled.
## flake8-simplify
"SIM105", # TODO: enable, most have autofixes.
"SIM108", # too opinionated.
## flake8-tidy-imports
"TID252", # we still use relative imports
## flake8-todos
"TD", # similar to flake8-fixme, though they may conflict
## flake8-typechecking
"TC001", # typing-only first party import
"TC002", # typing only third party import
"TC003", # typing only standard library import
## flake8-unused-arguments
"ARG", # most unused arguments are intentional
## flake8-use-pathlib
"PTH", # TODO: enable in separate PR
## mccabe
"C90",
## pep8-naming
"N", # too specific for now
## Perflint
"PERF203", # try, except within loops; # TODO: refactor
"PERF401", # TODO: enable!
## pycodestyle
"E501", # lines too long
"E731", # lambda expression assigned
## pydocstyle
"D1", "D205", "D400", "D401",
## Pylint
# PLC
"PLC0105",
"PLC0414",
"PLC0415",
"PLR",
# PLW
"PLW1641",
"PLW2901",
## Ruff-specific rules
"RUF006", # not actually sure this is a bug at all...
"RUF022", # TODO: consider enabling
"RUF023", # TODO: consider enabling
## tryceratops
"TRY003", # as of 0.12.11 still has some false positives
"TRY301", # TODO: enable
"TRY300", # TODO: enable
]
[tool.ruff.lint.per-file-ignores]
"disnake/*.py" = [
"F403", # Pyflakes: allow star imports
]
"disnake/client.py" = ["T201"]
## examples
"examples/*.py" = [
"ANN", # missing type annotations in examples is fine
"B008", # do not perform function calls in argument defaults, this is how most commands work
"E741", # allow ambiguous variable names
"EM", # allow Exception("text") for simplicity
"S104", # flake8-bandit: allow binding to all interfaces
"T201", # print found, printing is okay in examples
]
"examples/basic_voice.py" = ["S104"] # possible binding to all interfaces
## scripts
"scripts/*.py" = [
"S101", # flake8-bandit: allow scripts to use assertions
]
## tests
"!tests/*" = [ "PT" ] # enable PT in only the tests directory
"tests/*.py" = [
"E741", # ambiguous variable names
"S101", # flake8-bandit: allow tests to use assertions
"PT030", # to be enabled: allow pytest.warns without a match parameter
]
"noxfile.py" = ["EXE003"]
[tool.ruff.lint.flake8-annotations]
ignore-fully-untyped = true
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = [
"disnake.ext.commands.inject",
"disnake.ext.commands.Param",
"disnake.webhook.async_.AsyncWebhookAdapter",
]
[tool.ruff.lint.flake8-builtins]
ignorelist = [
"id",
"type",
"copyright",
"format",
# TODO: remove
"globals",
"locals",
]
[tool.ruff.lint.flake8-errmsg]
max-string-length = 0
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"subprocess".msg = "Consider possible security implications associated with the subprocess module." # replaces S404
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.isort]
combine-as-imports = true
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.pyupgrade]
keep-runtime-typing = true
[tool.towncrier]
template = "changelog/_template.rst.jinja"
package = "disnake"
filename = "docs/whats_new.rst"
directory = "changelog/"
title_format = false
underlines = "-~"
issue_format = ":issue:`{issue}`"
[[tool.towncrier.type]]
directory = "breaking"
name = "Breaking Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecate"
name = "Deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "New Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug Fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Miscellaneous"
showcontent = true
[tool.slotscheck]
strict-imports = true
require-superclass = true
require-subclass = false
exclude-modules = '''
(
^disnake\.types\.
)
'''
[tool.pyright]
typeCheckingMode = "strict"
include = [
"disnake",
"docs",
"examples",
"scripts",
"tests",
"*.py",
]
ignore = [
"disnake/ext/mypy_plugin",
]
# this is one of the diagnostics that aren't enabled by default, even in strict mode
reportUnnecessaryTypeIgnoreComment = true
# prefer "# pyright: ignore[ruleName]" over "# type: ignore"
enableTypeIgnoreComments = false
# it's unlikely that these will ever be enabled
reportOverlappingOverload = false
reportPrivateUsage = false
reportUnnecessaryIsInstance = false
reportFunctionMemberAccess = false
reportMissingTypeStubs = false
reportUnusedFunction = false
reportUnusedClass = false
reportConstantRedefinition = false
reportImportCycles = false
reportIncompatibleMethodOverride = false
reportIncompatibleVariableOverride = false
# TODO: re-enable
# these were added in the upgrade from pyright 1.1.336 to 1.1.405
reportInconsistentOverload = false
reportInvalidTypeVarUse = false
# these are largely due to missing type hints, and make up most of the error count
reportUnknownMemberType = false
reportUnknownParameterType = false
reportUnknownArgumentType = false
reportMissingParameterType = false
reportUnknownVariableType = false
reportMissingTypeArgument = false
[tool.pytest.ini_options]
minversion = "8.2"
pythonpath = "." # legacy configuration, new pytest versions don't add the rootdir to path
testpaths = "tests"
addopts = "--strict-markers -Werror -s"
xfail_strict = true
asyncio_mode = "strict"
[tool.coverage.run]
branch = true
include = [
"disnake/*",
"tests/*",
]
omit = [
"disnake/ext/mypy_plugin/*",
"disnake/types/*",
"disnake/__main__.py",
]
[tool.coverage.report]
precision = 1
exclude_lines = [
"# pragma: no cov(er(age)?)?$",
"^\\s*def __repr__",
"^\\s*@overload",
"^\\s*if TYPE_CHECKING",
"^\\s*raise NotImplementedError$",
"^\\s*\\.\\.\\.$",
]
[tool.check-wheel-contents]
toplevel = ["disnake"]
package = "disnake"