deluge/pyproject.toml
Calum Lind e7d08d7645
[Typing] Add pyright config to suppress warnings
VSCode uses pylance/pyright, a performant type checker. So
setup the builtins used by Deluge and set missing imports to
informational due to OS-specific imports.

It might be possible using extraPaths with extra stubs or use
defineConstants to make pyright not check Windows or Macos conditional
paths but that would require changing all usage so leaving for another
time.

Refs: https://github.com/microsoft/pyright/blob/main/docs/configuration.md
Refs: https://github.com/microsoft/pyright/blob/main/docs/builtins.md
2024-09-08 17:48:05 +01:00

65 lines
1.7 KiB
TOML

[build-system]
requires = ["setuptools", "wheel"]
[tool.pytest.ini_options]
# Dump tracebacks if a test takes longer than X seconds
faulthandler_timeout = 60
# Hide logged warnings and errors in test output.
log_cli_level = "CRITICAL"
addopts = "--basetemp=_pytest_temp"
markers = [
"todo: Tests that are yet to be written",
"gtkui: Tests for GTK code",
"security: Security related tests",
"slow: Tests that are particularly slow",
"internet: Tests that require internet connectivity",
]
filterwarnings = [
"ignore::DeprecationWarning:gi",
"ignore::DeprecationWarning:twisted.internet.gireactor",
"ignore:twisted.web.resource.*:DeprecationWarning",
"ignore:Using readBody.*:DeprecationWarning",
"ignore:resume_data is deprecated.*:DeprecationWarning:deluge.core.alertmanager",
]
[tool.ruff]
line-length = 88
builtins = ["_", "_n", "__request__"]
extend-exclude = ["dist", "build"]
target-version = "py37"
[tool.ruff.format]
# Prefer single quotes over double quotes
quote-style = "single"
[tool.ruff.lint]
ignore = [
"N818", # error-suffix-on-exception-name
"E501", # Line-too-long, let formatter resolve it
]
select = [
"A", # flake8-builtins
"E", # pycodestyle
"F", # Pyflakes
"N", # pep8-naming
"W", # pycodestyle
"INT", # flake8-gettext
"I", # isort
]
[tool.ruff.lint.flake8-gettext]
extend-function-names = ["_n"]
[tool.ruff.lint.extend-per-file-ignores]
# E402 import not top of file (gi version check required before import)
"deluge/**/gtkui/*.py" = ["E402"]
"deluge/**/gtkui.py" = ["E402"]
"deluge/plugins/Stats/deluge_stats/graph.py" = ["E402"]
"deluge/ui/gtk3/*.py" = ["E402"]
[tool.pyright]
reportMissingImports = "information"
reportMissingModuleSource = "information"