forked from python-telegram-bot/python-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
130 lines (116 loc) · 3.71 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
# BLACK:
[tool.black]
line-length = 99
target-version = ['py38', 'py39', 'py310', 'py311']
# ISORT:
[tool.isort] # black config
profile = "black"
line_length = 99
# RUFF:
[tool.ruff]
line-length = 99
target-version = "py38"
show-fixes = true
[tool.ruff.lint]
preview = true
explicit-preview-rules = true
ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PERF203"]
select = ["E", "F", "I", "PL", "UP", "RUF", "PTH", "C4", "B", "PIE", "SIM", "RET", "RSE",
"G", "ISC", "PT", "ASYNC", "TCH", "SLOT", "PERF", "PYI", "FLY", "AIR", "RUF022",
"RUF023", "Q", "INP", "W", "YTT", "DTZ", "ARG"]
# Add "FURB" after it's out of preview
# Add "A (flake8-builtins)" after we drop pylint
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["B018"]
"tests/**.py" = ["RUF012", "ASYNC101", "DTZ", "ARG"]
"docs/**.py" = ["INP001", "ARG"]
"examples/**.py" = ["ARG"]
# PYLINT:
[tool.pylint."messages control"]
enable = ["useless-suppression"]
disable = ["duplicate-code", "too-many-arguments", "too-many-public-methods",
"too-few-public-methods", "broad-exception-caught", "too-many-instance-attributes",
"fixme", "missing-function-docstring", "missing-class-docstring", "too-many-locals",
"too-many-lines", "too-many-branches", "too-many-statements", "cyclic-import"
]
[tool.pylint.main]
# run pylint across multiple cpu cores to speed it up-
# https://pylint.pycqa.org/en/latest/user_guide/run.html?#parallel-execution to know more
jobs = 0
[tool.pylint.classes]
exclude-protected = ["_unfrozen"]
# PYTEST:
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--no-success-flaky-report -rX"
filterwarnings = [
"error",
"ignore::DeprecationWarning",
'ignore:Tasks created via `Application\.create_task` while the application is not running',
"ignore::ResourceWarning",
# TODO: Write so good code that we don't need to ignore ResourceWarnings anymore
# Unfortunately due to https://github.com/pytest-dev/pytest/issues/8343 we can't have this here
# and instead do a trick directly in tests/conftest.py
# ignore::telegram.utils.deprecate.TelegramDeprecationWarning
]
markers = [
"dev", # If you want to test a specific test, use this
"no_req",
"req",
]
asyncio_mode = "auto"
log_format = "%(funcName)s - Line %(lineno)d - %(message)s"
# log_level = "DEBUG" # uncomment to see DEBUG logs
# MYPY:
[tool.mypy]
warn_unused_ignores = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
show_error_codes = true
python_version = "3.8"
# For some files, it's easier to just disable strict-optional all together instead of
# cluttering the code with `# type: ignore`s or stuff like
# `if self.text is None: raise RuntimeError()`
[[tool.mypy.overrides]]
module = [
"telegram._callbackquery",
"telegram._file",
"telegram._message",
"telegram._files.file"
]
strict_optional = false
# type hinting for asyncio in webhookhandler is a bit tricky because it depends on the OS
[[tool.mypy.overrides]]
module = "telegram.ext._utils.webhookhandler"
warn_unused_ignores = false
# The libs listed below are only used for the `customwebhookbot_*.py` examples
# let's just ignore type checking for them for now
[[tool.mypy.overrides]]
module = [
"flask.*",
"quart.*",
"starlette.*",
"uvicorn.*",
"asgiref.*",
"django.*",
"apscheduler.*", # not part of `customwebhookbot_*.py` examples
]
ignore_missing_imports = true
# COVERAGE:
[tool.coverage.run]
branch = true
source = ["telegram"]
parallel = true
concurrency = ["thread", "multiprocessing"]
omit = [
"tests/",
"telegram/__main__.py"
]
[tool.coverage.report]
exclude_also = [
"@overload",
"@abstractmethod",
"if TYPE_CHECKING:"
]