Skip to content

Commit 5d8b122

Browse files
committed
update pyright configuration
1 parent 9117da3 commit 5d8b122

File tree

1 file changed

+65
-33
lines changed

1 file changed

+65
-33
lines changed

pyproject.toml

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,22 @@ exclude = [
99

1010
pythonVersion = "3.12"
1111
pythonPlatform = "All"
12+
13+
14+
# strict doesn't allow turning off / downgrading severity of rules
1215
typeCheckingMode = "standard"
13-
analyzeUnannotatedFunctions = true
16+
17+
# type issues
1418
disableBytesTypePromotions = true
1519
strictParameterNoneValue = true
16-
enableTypeIgnoreComments = true
17-
enableReachabilityAnalysis = true
18-
strictListInference = true
19-
strictDictionaryInference = true
20-
strictSetInference = true
21-
deprecateTypingAliases = false
22-
enableExperimentalFeatures = false
2320
reportMissingTypeStubs = "error"
2421
reportMissingModuleSource = "warning"
2522
reportInvalidTypeForm = "error"
2623
reportMissingImports = "error"
2724
reportUndefinedVariable = "error"
28-
reportAssertAlwaysTrue = "none"
29-
reportInvalidStringEscapeSequence = "error"
3025
reportInvalidTypeVarUse = "error"
3126
reportSelfClsParameterName = "error"
32-
reportUnsupportedDunderAll = "error"
33-
reportUnusedExpression = "warning"
34-
reportWildcardImportFromLibrary = "error"
27+
3528
reportAbstractUsage = "error"
3629
reportArgumentType = "error"
3730
reportAssertTypeFailure = "error"
@@ -50,13 +43,9 @@ reportOptionalCall = "error"
5043
reportOptionalIterable = "error"
5144
reportOptionalContextManager = "error"
5245
reportOptionalOperand = "error"
53-
reportRedeclaration = "error"
5446
reportReturnType = "error"
5547
reportTypedDictNotRequiredAccess = "error"
56-
reportPrivateImportUsage = "warning"
57-
reportUnboundVariable = "error"
5848
reportUnhashable = "error"
59-
reportUnusedCoroutine = "warning"
6049
reportUnusedExcept = "error"
6150
reportFunctionMemberAccess = "error"
6251
reportIncompatibleMethodOverride = "error"
@@ -65,42 +54,85 @@ reportOverlappingOverload = "error"
6554
reportPossiblyUnboundVariable = "error"
6655
reportConstantRedefinition = "error"
6756
reportDeprecated = "warning"
68-
reportDuplicateImport = "none"
57+
6958
reportIncompleteStub = "error"
7059
reportInconsistentConstructor = "error"
7160
reportInvalidStubStatement = "error"
7261
reportMatchNotExhaustive = "error"
7362
reportMissingParameterType = "error"
74-
reportMissingTypeArgument = "error"
75-
reportPrivateUsage = "warning"
76-
reportTypeCommentUsage = "error"
63+
7764
reportUnknownArgumentType = "error"
7865
reportUnknownLambdaType = "error"
7966
reportUnknownMemberType = "error"
8067
reportUnknownParameterType = "error"
8168
reportUnknownVariableType = "error"
8269
reportUnnecessaryCast = "warning"
70+
71+
reportCallInDefaultInitializer = "warning"
72+
reportMissingSuperCall = "none"
73+
reportPropertyTypeMismatch = "error"
74+
75+
# other type-issues
76+
77+
reportUntypedBaseClass = "warning" # spec says treat this as Any
78+
reportUntypedClassDecorator = "warning" # spec says (Any) -> Any
79+
reportUntypedFunctionDecorator = "warning" # spec says (Any) -> Any
80+
reportUntypedNamedTuple = "none" # Just no.
81+
82+
# not type issues, even if pyright and mypy offer checks as if they were
83+
# by calling them "Strict mode checks"
84+
# these are "opinionated errors with well-defined type interpretation"
85+
86+
reportImplicitOverride = "none"
87+
reportMissingTypeArgument = "none"
88+
deprecateTypingAliases = false
8389
reportUnnecessaryComparison = "none"
8490
reportUnnecessaryContains = "none"
8591
reportUnnecessaryIsInstance = "none"
92+
reportAssertAlwaysTrue = "none"
93+
reportTypeCommentUsage = "none"
94+
95+
# reasonably preventing accidents
96+
97+
reportUnnecessaryTypeIgnoreComment = "warning"
98+
99+
reportUnsupportedDunderAll = "error"
100+
reportWildcardImportFromLibrary = "error"
101+
reportShadowedImports = "warning"
102+
103+
reportUninitializedInstanceVariable = "warning"
104+
reportUnusedCoroutine = "warning"
105+
reportUnusedExpression = "warning"
106+
107+
reportPrivateUsage = "warning"
108+
reportPrivateImportUsage = "warning"
109+
110+
reportInvalidStringEscapeSequence = "error"
111+
reportRedeclaration = "error"
112+
reportUnboundVariable = "error"
113+
86114
reportUnusedClass = "warning"
87115
reportUnusedImport = "warning"
88116
reportUnusedFunction = "warning"
89117
reportUnusedVariable = "warning"
90-
reportUntypedBaseClass = "error"
91-
reportUntypedClassDecorator = "error"
92-
reportUntypedFunctionDecorator = "error"
93-
reportUntypedNamedTuple = "warning"
94-
reportCallInDefaultInitializer = "warning"
95-
reportImplicitOverride = "none"
96-
reportImplicitStringConcatenation = "warning"
118+
119+
# analysis behavior
120+
enableTypeIgnoreComments = true
121+
enableReachabilityAnalysis = true
122+
analyzeUnannotatedFunctions = true
97123
reportImportCycles = "error"
98-
reportMissingSuperCall = "none"
99-
reportPropertyTypeMismatch = "error"
100-
reportShadowedImports = "error"
101-
reportUninitializedInstanceVariable = "error"
102-
reportUnnecessaryTypeIgnoreComment = "warning"
124+
enableExperimentalFeatures = false
125+
126+
# inference settings
127+
strictListInference = true
128+
strictDictionaryInference = true
129+
strictSetInference = true
130+
131+
# overly-worriesome linter-esque options
132+
reportImplicitStringConcatenation = "none"
103133
reportUnusedCallResult = "none"
134+
reportDuplicateImport = "none" # handled by ruff
135+
104136

105137

106138
[tool.ruff]

0 commit comments

Comments
 (0)