-
-
Notifications
You must be signed in to change notification settings - Fork 341
/
pyproject.toml
311 lines (277 loc) · 9.13 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
[build-system]
requires = ["setuptools >= 64"]
build-backend = "setuptools.build_meta"
[project]
name = "trio"
description = "A friendly Python library for async concurrency and I/O"
authors = [{name = "Nathaniel J. Smith", email = "njs@pobox.com"}]
license = {text = "MIT OR Apache-2.0"}
keywords = [
"async",
"io",
"networking",
"trio",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Trio",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: BSD",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: System :: Networking",
"Typing :: Typed",
]
requires-python = ">=3.9"
dependencies = [
# attrs 19.2.0 adds `eq` option to decorators
# attrs 20.1.0 adds @frozen
# attrs 21.1.0 adds a dataclass transform for type-checkers
# attrs 21.3.0 adds `import attrs`
"attrs >= 23.2.0",
"sortedcontainers",
"idna",
"outcome",
"sniffio >= 1.3.0",
# cffi 1.12 adds from_buffer(require_writable=True) and ffi.release()
# cffi 1.14 fixes memory leak inside ffi.getwinerror()
# cffi is required on Windows, except on PyPy where it is built-in
"cffi>=1.14; os_name == 'nt' and implementation_name != 'pypy'",
"exceptiongroup; python_version < '3.11'",
]
dynamic = ["version"]
[project.readme]
file = "README.rst"
content-type = "text/x-rst"
[project.urls]
Homepage = "https://github.com/python-trio/trio"
Documentation = "https://trio.readthedocs.io/"
Changelog = "https://trio.readthedocs.io/en/latest/history.html"
[project.entry-points.hypothesis]
trio = "trio._core._run:_hypothesis_plugin_setup"
[tool.setuptools]
# This means, just install *everything* you see under trio/, even if it
# doesn't look like a source file, so long as it appears in MANIFEST.in:
include-package-data = true
[tool.setuptools.dynamic]
version = {attr = "trio._version.__version__"}
[tool.black]
force-exclude = '''
(
^/docs/source/reference-.*
| ^/docs/source/tutorial
)
'''
[tool.codespell]
ignore-words-list = 'astroid,crasher,asend'
[tool.ruff]
respect-gitignore = true
fix = true
# The directories to consider when resolving first vs. third-party imports.
# Does not control what files to include/exclude!
src = ["src/trio", "notes-to-self"]
include = ["*.py", "*.pyi", "**/pyproject.toml"]
extend-exclude = [
"docs/source/reference-*",
"docs/source/tutorial/*",
]
[tool.ruff.lint]
preview = true
allowed-confusables = ["–"]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"COM", # flake8-commas
"E", # Error
"EXE", # flake8-executable
"F", # pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"FURB", # refurb
"I", # isort
"ICN", # flake8-import-conventions
"PERF", # Perflint
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"UP", # pyupgrade
"W", # Warning
"YTT", # flake8-2020
]
extend-ignore = [
'A002', # builtin-argument-shadowing
'ANN101', # missing-type-self
'ANN102', # missing-type-cls
'ANN401', # any-type (mypy's `disallow_any_explicit` is better)
'E402', # module-import-not-at-top-of-file (usually OS-specific)
'E501', # line-too-long
'F403', # undefined-local-with-import-star
'F405', # undefined-local-with-import-star-usage
'PERF203', # try-except-in-loop (not always possible to refactor)
'PT012', # multiple statements in pytest.raises block
'SIM117', # multiple-with-statements (messes up lots of context-based stuff and looks bad)
]
[tool.ruff.lint.per-file-ignores]
# F401 is ignoring unused imports. For these particular files,
# these are public APIs where we are importing everything we want
# to export for public use.
'src/trio/__init__.py' = ['F401']
'src/trio/_core/__init__.py' = ['F401']
'src/trio/abc.py' = ['F401', 'A005']
'src/trio/lowlevel.py' = ['F401']
'src/trio/socket.py' = ['F401', 'A005']
'src/trio/testing/__init__.py' = ['F401']
# RUF029 is ignoring tests that are marked as async functions but
# do not use an await in their function bodies. There are several
# places where internal trio synchronous code relies on being
# called from an async function, where current task is set up.
'src/trio/_tests/*.py' = ['RUF029']
'src/trio/_core/_tests/*.py' = ['RUF029']
# A005 is ignoring modules that shadow stdlib modules.
'src/trio/_abc.py' = ['A005']
'src/trio/_socket.py' = ['A005']
'src/trio/_ssl.py' = ['A005']
# Don't check annotations in notes-to-self
'notes-to-self/*.py' = ['ANN001', 'ANN002', 'ANN003', 'ANN201', 'ANN202', 'ANN204']
[tool.ruff.lint.isort]
combine-as-imports = true
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
[tool.mypy]
python_version = "3.9"
files = ["src/trio/", "docs/source/*.py"]
# Be flexible about dependencies that don't have stubs yet (like pytest)
ignore_missing_imports = true
# Be strict about use of Mypy
local_partial_types = true
warn_unused_ignores = true
warn_unused_configs = true
warn_redundant_casts = true
warn_return_any = true
# Avoid subtle backsliding
disallow_any_decorated = true
disallow_any_explicit = true
disallow_any_generics = true
disallow_any_unimported = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
check_untyped_defs = true
[tool.pyright]
pythonVersion = "3.9"
reportUnnecessaryTypeIgnoreComment = true
typeCheckingMode = "strict"
[tool.pytest.ini_options]
addopts = ["--strict-markers", "--strict-config", "-p trio._tests.pytest_plugin"]
faulthandler_timeout = 60
filterwarnings = [
"error",
# https://gitter.im/python-trio/general?at=63bb8d0740557a3d5c688d67
'ignore:You are using cryptography on a 32-bit Python on a 64-bit Windows Operating System. Cryptography will be significantly faster if you switch to using a 64-bit Python.:UserWarning',
# https://github.com/berkerpeksag/astor/issues/217
'ignore:ast.Num is deprecated:DeprecationWarning:astor',
]
junit_family = "xunit2"
markers = ["redistributors_should_skip: tests that should be skipped by downstream redistributors"]
xfail_strict = true
[tool.towncrier]
directory = "newsfragments"
filename = "docs/source/history.rst"
issue_format = "`#{issue} <https://github.com/python-trio/trio/issues/{issue}>`__"
# Usage:
# - PRs should drop a file like "issuenumber.feature" in newsfragments
# (or "bugfix", "doc", "removal", "misc"; misc gets no text, we can
# customize this)
# - At release time after bumping version number, run: towncrier
# (or towncrier --draft)
package = "trio"
package_dir = "src"
underlines = ["-", "~", "^"]
[[tool.towncrier.type]]
directory = "headline"
name = "Headline features"
showcontent = true
[[tool.towncrier.type]]
directory = "breaking"
name = "Breaking changes"
showcontent = true
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "deprecated"
name = "Deprecations and removals"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Removals without deprecations"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Miscellaneous internal changes"
showcontent = true
[tool.coverage.run]
branch = true
source_pkgs = ["trio"]
omit = [
# Omit the generated files in trio/_core starting with _generated_
"*/trio/_core/_generated_*",
# Type tests aren't intended to be run, just passed to type checkers.
"*/type_tests/*",
# Script used to check type completeness that isn't run in tests
"*/trio/_tests/check_type_completeness.py",
]
# The test suite spawns subprocesses to test some stuff, so make sure
# this doesn't corrupt the coverage files
parallel = true
[tool.coverage.report]
precision = 1
skip_covered = true
exclude_lines = [
"pragma: no cover",
"abc.abstractmethod",
"if TYPE_CHECKING.*:",
"if _t.TYPE_CHECKING:",
"if t.TYPE_CHECKING:",
"@overload",
'class .*\bProtocol\b.*\):',
"raise NotImplementedError",
]
partial_branches = [
"pragma: no branch",
"if not TYPE_CHECKING:",
"if not _t.TYPE_CHECKING:",
"if not t.TYPE_CHECKING:",
"if .* or not TYPE_CHECKING:",
"if .* or not _t.TYPE_CHECKING:",
"if .* or not t.TYPE_CHECKING:",
]