-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
98 lines (79 loc) · 3.16 KB
/
pyproject.toml
File metadata and controls
98 lines (79 loc) · 3.16 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
# NOTE: This file is used for tool configuration only.
# Dependencies are managed via requirements.txt.
# Copyright (c) 2026 Jan Van Herck
# GitHub: https://github.com/jvherck
[tool.black]
line-length = 120
target-version = ["py311", "py312", "py313", "py314"]
include = '\.pyi?$'
[tool.ruff]
line-length = 120
target-version = "py311"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by black)
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
[tool.mypy]
# The python version we are targeting
python_version = "3.11"
# Warns if you define a [tool.mypy] config option that doesn't exist.
warn_unused_configs = true
# If true, Mypy will also check the body of functions that don't have type hints.
# It helps catch logical errors even in untyped code.
check_untyped_defs = true
# If true, Mypy ignores errors when importing libraries that don't have type stubs.
# Essential for discord.py bots to avoid false positives.
ignore_missing_imports = true
# If true, warns if you cast a variable to a type that is redundant (e.g. str to str).
# Keeps code clean by highlighting unnecessary casts.
warn_redundant_casts = true
# If true, warns if you use a `# type: ignore` comment that wasn't actually needed.
# Helps keep code clean by removing stale ignores that are no longer suppressing errors.
warn_unused_ignores = true
# --- Strictness Settings (Set to false for beginners) ---
# If true, you MUST add type hints to every single function.
# False allows "normal" dynamic Python code.
disallow_untyped_defs = false
# If true, you cannot leave a type definition half-finished (e.g., `list` without `list[str]`).
disallow_incomplete_defs = false
# If true, you must write `x: Optional[str] = None` instead of `x: str = None`.
# False is much easier for beginners to read.
no_implicit_optional = false
# If true, warns if a function returns `Any` when it was supposed to return a specific type.
# False is better for prototyping when you aren't sure of data structures yet.
warn_return_any = false
# If true, warns if a function is missing a return statement.
warn_no_return = false
# If true, strict equality checks (e.g. preventing `if str_var == 0:`).
strict_equality = false
# --- Specific Error Suppressions ---
# "union-attr": accessing .name on a variable that could be None.
# "arg-type": passing a variable that could be None to a function expecting a value.
# "assignment": assigning a value to a variable that Mypy inferred as a different type (e.g. None).
# "attr-defined": accessing an attribute Mypy doesn't know about.
# "call-overload": Issues with complex function signatures (like SQLAlchemy execute).
# "misc": General errors like the super() init issue.
# "override": Overriding a parent method with a different return type.
disable_error_code = [
"union-attr",
"arg-type",
"assignment",
"attr-defined",
"call-overload",
"misc",
"override"
]
[[tool.mypy.overrides]]
module = "discord.*"
ignore_missing_imports = true