-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpyproject.toml
178 lines (153 loc) · 6.56 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
[tool.pyright]
include = ["src"]
exclude = [
"**/__pycache__",
"build",
"dist",
"docs",
]
pythonVersion = "3.12"
typeCheckingMode = "strict"
pythonPlatform = "All"
reportImportCycles = "error"
reportPropertyTypeMismatch = "error"
reportShadowedImports = "error"
reportUninitializedInstanceVariable = "error"
reportUnnecessaryTypeIgnoreComment = "warning"
[tool.ruff]
line-length = 90
target-version = "py312"
preview = true
[tool.ruff.format]
line-ending = "lf"
[tool.ruff.lint]
select = [
"A", "ANN", "ASYNC", "B", "BLE", "C4", "COM", "D", "DOC", "DTZ", "E",
"EM", "ERA", "F", "FA", "FBT", "FURB", "G", "I", "ICN", "INP", "ISC", "LOG", "NPY",
"PD", "PERF", "PGH", "PIE", "PLC", "PLE", "PLR", "PLW", "PTH", "PYI",
"Q", "Q003", "RET", "RSE", "RUF", "S", "SIM", "SLOT", "T20", "TC", "TID",
"TRY", "UP", "W", "YTT"
]
typing-modules = ["async_utils._typings"]
ignore = [
"DOC201", # Not docing generic return types
"DOC501", # Not explicitly documenting raised exception types
"ANN202", # implied return fine sometimes
"ANN401", # Any is the correct type in some cases
"ASYNC116", # Long sleeps are fine
"B901", # I'm aware of how generators as coroutines work
"B903", # nope, handwritten types are fine actually.
"C90", # mccabe complexity memes
"COM812", # ruff format suggested
"D100", # no, module level docs aren't always neededd
"D105", # documenting magic methods is often dumb.
"D107", # __init__ is the wrong place to doc this.
"E501", # ruff format suggested
"FBT003", # Wrong end to enforce this on.
"G002", # erroneous issue with %-logging when logging can be confiured for % logging
"ISC001", # ruff format suggested
"PLC0105", # no, I don't like co naming style for typevars
"PLC0415", # ruff gets this wrong, import needs to be not at top of file in some cases
"PLR0912", # too many branches
"PLR0913", # number of function arguments
"PLR0915", # too many statements.... in an async entrypoint handling graceful shutdown...
"PLR0917", # too many positional arguments
"PLR2004", # Magic value comparison, may remove later
"RUF001", # ambiguous characters not something I want to enforce here.
"RUF029", # no, don't try andd tell me I'm wrong for async def when something is for an interface.
"S101", # use of assert here is a known quantity, blame typing memes
"S311", # Yes, I know that standard pseudo-random generators are not suitable for cryptographic purposes
"SIM105", # supressable exception, I'm not paying the overhead of contextlib.supress for stylistic choices.
"TC001", # I prefer to avoid if TYPE_CHECKING
"TC002", # I prefer to avoid if TYPE_CHECKING
"TC003", # I prefer to avoid if TYPE_CHECKING
"UP007", # "Use | For Union" doesn't account for typevar tuple unpacking.
"UP031", # No, I like % formatting more for some things...
"UP038", # isinstance on union types... perf + type construct symmetry issues.
# As PYI058 modifies return values to be more narrow than they actually are
"PYI058", # This opinionated "fix" causes incompatabilties with things expecting a generator.
]
unfixable = [
"E501", # line length handled in other ways by ruff format
"ERA", # Don't delete commented out code
]
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.ruff.lint.flake8-comprehensions]
allow-dict-calls-with-keyword-arguments = true
[tool.ruff.lint.flake8-import-conventions.aliases]
"concurrent.futures" = "cf"
[tool.ruff.lint.flake8-tidy-imports.banned-api]
# https://discuss.python.org/t/problems-with-typeis/55410/6
# https://discuss.python.org/t/problems-with-typeis/55410/46
# Until what can go into a TypeIs/TypeGuard changes, these are just dangerous.
"typing.TypeIs".msg = "TypeIs is fundamentally unsafe, even when using it as described to be safe"
"typing.TypeGuard".msg = "TypeGuard is fundamentally unsafe"
"typing_extensions.TypeIs".msg = "TypeIs is fundamentally unsafe, even when using it as described to be safe"
"typing_extensions.TypeGuard".msg = "TypeGuard is fundamentally unsafe"
"typing.runtime_checkable".msg = "Runtime checkable is fundamentally unsafe."
"typing_extensions.runtime_checkable".msg = "Runtime checkable is fundamentally unsafe."
# these don't work as deferred imports, intentionally, because type checkers are dumb
# and require they be imported directly from typing to work, this breaks the deferred re-export.
"typing.Final".msg = "see https://github.com/microsoft/pyright/issues/9664#issuecomment-2574042580"
"typing_extensions.Final".msg = "see https://github.com/microsoft/pyright/issues/9664#issuecomment-2574042580"
"typing.final".msg = "see https://github.com/microsoft/pyright/issues/9664#issuecomment-2574042580"
"typing_extensions.final".msg = "see https://github.com/microsoft/pyright/issues/9664#issuecomment-2574042580"
[project]
name = "mikeshardmind-async-utils"
description = "Various async utilities"
readme = "readme.md"
license = {text = "Apache-2.0"}
requires-python = ">=3.12.0"
authors = [
{ name = "Michael Hall", email = "[email protected]" },
]
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Typing :: Typed",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"Natural Language :: English",
"Typing :: Typed",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = ["version"]
dependencies = []
[project.urls]
Homepage = "https://github.com/mikeshardmind/async-utils"
"Issue Tracker" = "https://github.com/mikeshardmind/async-utils/issues"
"Source Code" = "https://github.com/mikeshardmind/async-utils"
[tool.pdm.version]
source = "file"
path = "src/async_utils/__init__.py"
[tool.pdm.build]
excludes = ["./**/.git"]
package-dir = "src"
includes = ["src/async_utils"]
source-includes = ["LICENSE", "NOTICE", "readme.md"]
[tool.pdm]
distribution = true
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
# mypy support is provided on an "as reasonable" basis.
# and may be limited to the public api surface
[tool.mypy]
python_version = 3.12
warn_unused_configs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_unimported = true
strict_optional = true
report_deprecated_as_note = true
disallow_untyped_globals = true
extra_checks = true