disnake
/
pyproject.toml
398 строк · 10.9 Кб
1# SPDX-License-Identifier: MIT
2
3[build-system]4requires = ["setuptools>=61"]5build-backend = "setuptools.build_meta"6
7[project]8name = "disnake"9description = "A Python wrapper for the Discord API"10readme = "README.md"11authors = [12{ name = "Disnake Development" }13]
14requires-python = ">=3.8"15keywords = ["disnake", "discord", "discord api"]16license = { text = "MIT" }17dependencies = [18"aiohttp>=3.7.0,<4.0",19]
20classifiers = [21"Development Status :: 5 - Production/Stable",22"License :: OSI Approved :: MIT License",23"Intended Audience :: Developers",24"Natural Language :: English",25"Operating System :: OS Independent",26"Programming Language :: Python :: 3.8",27"Programming Language :: Python :: 3.9",28"Programming Language :: Python :: 3.10",29"Programming Language :: Python :: 3.11",30"Programming Language :: Python :: 3.12",31"Topic :: Internet",32"Topic :: Software Development :: Libraries",33"Topic :: Software Development :: Libraries :: Python Modules",34"Topic :: Utilities",35"Typing :: Typed",36]
37dynamic = ["version"]38
39[project.urls]40Changelog = "https://docs.disnake.dev/page/whats_new.html"41Documentation = "https://docs.disnake.dev/"42Repository = "https://github.com/DisnakeDev/disnake"43
44[project.optional-dependencies]45speed = [46"orjson~=3.6",47# taken from aiohttp[speedups]48"aiodns>=1.1",49"Brotli",50'cchardet; python_version < "3.10"',51]
52voice = [53"PyNaCl>=1.3.0,<1.6",54]
55docs = [56"sphinx==7.0.1",57"sphinxcontrib-trio~=1.1.2",58"sphinx-hoverxref==1.3.0",59"sphinx-autobuild~=2021.3",60"sphinxcontrib-towncrier==0.3.2a0",61"towncrier==23.6.0",62"sphinx-notfound-page==0.8.3",63]
64discord = ["discord-disnake"]65
66[tool.pdm.dev-dependencies]67nox = [68"nox==2022.11.21",69]
70tools = [71"pre-commit~=3.0",72"slotscheck~=0.16.4",73"python-dotenv~=1.0.0",74"check-manifest==0.49",75"ruff==0.0.292",76]
77changelog = [78"towncrier==23.6.0",79]
80codemod = [81# run codemods on the respository (mostly automated typing)82"libcst~=1.1.0",83"black==23.9.1",84"autotyping==23.2.0",85]
86typing = [87# this is not pyright itself, but the python wrapper88"pyright==1.1.336",89"typing-extensions~=4.8.0",90# only used for type-checking, version does not matter91"pytz",92]
93test = [94"pytest~=7.4.2",95"pytest-cov~=4.0.0",96"pytest-asyncio~=0.20.3",97"looptime~=0.2",98"coverage[toml]~=6.5.0",99]
100build = [101"wheel~=0.40.0",102"build~=0.10.0",103"twine~=4.0.2",104]
105
106[tool.pdm.scripts]107black = { composite = ["lint black"], help = "Run black" }108docs = { cmd = "nox -Rs docs --", help = "Build the documentation for development" }109isort = { composite = ["lint isort"], help = "Run isort" }110lint = { cmd = "nox -Rs lint --", help = "Check all files for linting errors" }111pyright = { cmd = "nox -Rs pyright --", help = "Run pyright" }112setup_env = { cmd = "pdm install -d -G speed -G docs -G voice", help = "Set up the local environment and all dependencies" }113post_setup_env = { composite = ["python -m ensurepip --default-pip", "pre-commit install --install-hooks"] }114test = { cmd = "nox -Rs test --", help = "Run pytest" }115
116# legacy tasks for those who still type `task`
117[tool.taskipy.tasks]118black = { cmd = "black", help = "Run black" }119docs = { cmd = "docs", help = "Build the documentation for development" }120isort = { cmd = "isort", help = "Run isort" }121lint = { cmd = "lint", help = "Check all files for linting errors" }122pyright = { cmd = "pyright", help = "Run pyright" }123setup_env = { cmd = "setup_env", help = "Setup the local environment and set up all dependencies" }124test = { cmd = "test", help = "Run pytest" }125
126[tool.taskipy.settings]127runner = "pdm run"128
129[tool.black]130line-length = 100131target-version = ["py38", "py39", "py310", "py311", "py312"]132
133[tool.isort]134profile = "black"135py_version = 38136line_length = 100137combine_as_imports = true138filter_files = true139
140[tool.ruff]141line-length = 100142target-version = "py38"143select = [144# commented out codes are intended to be enabled in future prs145"F", # pyflakes146"E", "W", # pycodestyle147# "D", # pydocstyle148"D2", # pydocstyle, docstring formatting149"D4", # pydocstyle, docstring structure/content150# "ANN", # flake8-annotations151"S", # flake8-bandit152"B", # flake8-bugbear153"C4", # flake8-comprehensions154"DTZ", # flake8-datetimez155# "EM", # flake8-errmsg156"G", # flake8-logging-format157# "RET", # flake8-return158# "SIM", # flake8-simplify159"TID251", # flake8-tidy-imports, replaces S404160"TCH", # flake8-type-checking161"RUF", # ruff specific exceptions162"PT", # flake8-pytest-style163"Q", # flake8-quotes164"RSE", # flake8-raise165"T20", # flake8-print166"PGH", # pygrep-hooks167"PLC", # pylint convention168"PLE", # pylint error169# "PLR", # pylint refactor170"PLW", # pylint warnings171"TRY002", "TRY004", "TRY201", # tryceratops172]
173ignore = [174# star imports175"F403",176
177# pydocstyle178"D203", # incompat with D211179"D213", # multiline docstring should start on second line, incompatiable with D212180"D400", # first line ends in period, does not work with `|coro|` etc.181"D415", # same thing but punctuation in general182"D416", # section name should end with a colon, incompatible with D406183
184# unknown if this is actually an issue185"RUF005", # might not be actually faster186"RUF006", # might not be an issue/very extreme cases187
188# calling subprocess with dynamic arguments is generally fine, the only way to avoid this is ignoring it189"S603",190
191# partial executable paths (i.e. "git" instead of "/usr/bin/git") are fine192"S607",193
194# ignore try-except-pass. Bare excepts are caught with E722195"S110",196
197# provide specific codes on type: ignore198"PGH003",199
200# typevar names don't match variance (we don't always want this)201"PLC0105",202
203# import aliases are fixed by isort204"PLC0414",205
206# outer loop variables are overwritten by inner assignment target, these are mostly intentional207"PLW2901",208
209# ignore imports that could be moved into type-checking blocks210# (no real advantage other than possibly avoiding cycles,211# but can be dangerous in places where we need to parse signatures)212"TCH001",213"TCH002",214"TCH003",215
216# temporary disables, to fix later217"D205", # blank line required between summary and description218"D401", # first line of docstring should be in imperative mood219"D417", # missing argument description in docstring220"B904", # within an except clause raise from error or from none221"B026", # backwards star-arg unpacking222"E501", # line too long223"E731", # assigning lambdas to variables224"T201", # print statements225]
226
227[tool.ruff.per-file-ignores]228"disnake/__main__.py" = ["T201"] # print statements are okay in our simple cli229"disnake/i18n.py" = [230"B027", # lib bug. Excluded here because ruff does not have a --disable-noqa flag yet231]
232"disnake/ui/select/*.py" = [233"F401", # unused imports. Excluded because there is a bug with ruff.234]
235"disnake/**.py" = ["PT"] # this is not a module of pytest tests236"test_bot/*.py" = [237"B008", # do not perform function calls in argument defaults238"T201", # print found, printing is currently accepted in the test bot239"PT", # this is not a module of pytest tests240]
241"tests/*.py" = ["S101"] # use of assert is okay in test files242"scripts/*.py" = ["S101"] # use of assert is okay in scripts243# we are not using noqa in the example files themselves
244"examples/*.py" = [245"B008", # do not perform function calls in argument defaults, this is how most commands work246"PT", # this is not a module of pytest tests247"S311", # pseudo-random generators aren't suitable for cryptographic purposes248"T201", # print found, printing is okay in examples249]
250"examples/basic_voice.py" = ["S104"] # possible binding to all interfaces251"examples/views/tic_tac_toe.py" = ["E741"] # ambigious variable name: `O`252
253[tool.ruff.flake8-pytest-style]254fixture-parentheses = false255mark-parentheses = false256
257[tool.ruff.flake8-tidy-imports.banned-api]258"subprocess".msg = "Consider possible security implications associated with the subprocess module." # replaces S404259
260[tool.towncrier]261template = "changelog/_template.rst.jinja"262package = "disnake"263filename = "docs/whats_new.rst"264directory = "changelog/"265title_format = false266underlines = "-~"267issue_format = ":issue:`{issue}`"268
269[[tool.towncrier.type]]270directory = "breaking"271name = "Breaking Changes"272showcontent = true273
274[[tool.towncrier.type]]275directory = "deprecate"276name = "Deprecations"277showcontent = true278
279[[tool.towncrier.type]]280directory = "feature"281name = "New Features"282showcontent = true283
284[[tool.towncrier.type]]285directory = "bugfix"286name = "Bug Fixes"287showcontent = true288
289[[tool.towncrier.type]]290directory = "doc"291name = "Documentation"292showcontent = true293
294[[tool.towncrier.type]]295directory = "misc"296name = "Miscellaneous"297showcontent = true298
299
300[tool.slotscheck]301strict-imports = true302require-superclass = true303require-subclass = false304exclude-modules = '''305(
306^disnake\.types\.
307)
308'''
309
310
311[tool.pyright]312typeCheckingMode = "strict"313include = [314"disnake",315"docs",316"examples",317"test_bot",318"tests",319"*.py",320]
321ignore = [322"disnake/ext/mypy_plugin",323]
324
325# this is one of the diagnostics that aren't enabled by default, even in strict mode
326reportUnnecessaryTypeIgnoreComment = true327
328# it's unlikely that these will ever be enabled
329reportOverlappingOverload = false330reportPrivateUsage = false331reportUnnecessaryIsInstance = false332reportFunctionMemberAccess = false333reportMissingTypeStubs = false334reportUnusedFunction = false335reportUnusedClass = false336reportConstantRedefinition = false337reportImportCycles = false338reportIncompatibleMethodOverride = false339reportIncompatibleVariableOverride = false340
341# these are largely due to missing type hints, and make up most of the error count
342reportUnknownMemberType = false343reportUnknownParameterType = false344reportUnknownArgumentType = false345reportMissingParameterType = false346reportUnknownVariableType = false347reportMissingTypeArgument = false348
349
350[tool.pytest.ini_options]351testpaths = "tests"352addopts = "--strict-markers -Werror -s"353xfail_strict = true354asyncio_mode = "strict"355
356[tool.coverage.run]357branch = true358include = [359"disnake/*",360"tests/*",361]
362omit = [363"disnake/ext/mypy_plugin/*",364"disnake/types/*",365"disnake/__main__.py",366]
367
368[tool.coverage.report]369precision = 1370exclude_lines = [371"# pragma: no cov(er(age)?)?$",372"^\\s*def __repr__",373"^\\s*@overload",374"^\\s*if TYPE_CHECKING",375"^\\s*raise NotImplementedError$",376"^\\s*\\.\\.\\.$",377]
378
379
380[tool.check-manifest]381ignore = [382# CI383".pre-commit-config.yaml",384".readthedocs.yml",385".libcst.codemod.yaml",386"noxfile.py",387# docs388"CONTRIBUTING.md",389"RELEASE.md",390"assets/**",391"changelog/**",392"docs/**",393"examples/**",394# tests395"test_bot/**",396"tests/**",397"scripts/**",398]
399