Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
274 lines (226 loc) · 6.71 KB
/
Copy pathpyproject.toml
File metadata and controls
274 lines (226 loc) · 6.71 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
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
[build-system]
requires = ["hatchling<2", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
[project]
dynamic = ["version", "readme"]
name = "bgt"
description = "Fault-tolerant background threads for Python"
license = "MIT"
license-files = ["LICENSE"]
authors = [{ name = "Hynek Schlawack", email = "hs@ox.cx" }]
requires-python = ">=3.12"
dependencies = [
"attrs",
"prometheus-client",
"structlog>=25.3.0",
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Typing :: Typed",
]
keywords = [
"background tasks",
"background threads",
"crash-only",
"supervisor",
]
[project.urls]
Changelog = "https://github.com/hynek/bgt/blob/main/CHANGELOG.md"
Documentation = "https://bgt.hynek.me/"
Funding = "https://github.com/sponsors/hynek"
GitHub = "https://github.com/hynek/bgt"
Mastodon = "https://mastodon.social/@hynek"
Bluesky = "https://bsky.app/profile/hynek.me"
[tool.uv]
# Dependency cooldown
exclude-newer = "1 week"
[tool.hatch.version]
source = "vcs"
raw-options = { local_scheme = "no-local-version" }
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- --8<-- [start:header] -->\n"
end-before = "<!-- --8<-- [end:header] -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- --8<-- [start:spiel] -->"
end-before = "\n<!-- --8<-- [start:credits] -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = """
## Release Information
"""
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "CHANGELOG.md"
start-after = "<!-- changelog follows -->"
pattern = "\n(###.+?\n)## "
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = """
---
[Full Changelog →](https://github.com/hynek/bgt/blob/main/CHANGELOG.md)
"""
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-at = "## Credits"
end-before = "\n<!-- --8<-- [end:credits] -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '> \[!(.*)\]'
replacement = '> **\1**'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = ']\(\./(.*)\)'
replacement = '](https://github.com/hynek/bgt/blob/main/\1)'
[dependency-groups]
tests = [
"pytest>=9",
]
cov = [
{ include-group = "tests" },
"coverage",
]
docs = [
"mkdocstrings-python",
"zensical",
]
mypy = [
"mypy",
]
pyright = [
"pyright",
]
ty = [
"ty>=0.0.21",
]
pyrefly = [
"pyrefly",
]
lint = [
"prek",
"ruff",
]
tox = [
"tox>=4.51.1",
"tox-uv-bare",
]
dev = [
{ include-group = "cov" },
{ include-group = "mypy" },
{ include-group = "pyright" },
{ include-group = "ty" },
{ include-group = "pyrefly" },
{ include-group = "lint" },
{ include-group = "tox" },
]
[tool.pytest]
strict = true
testpaths = ["tests"]
addopts = ["-ra", "--import-mode=importlib"]
log_level = "INFO"
filterwarnings = ["once::Warning"]
[tool.coverage.run]
branch = true
parallel = true
source = ["bgt", "tests"]
[tool.coverage.paths]
source = ["src", ".tox/*-tests/**/site-packages"]
[tool.coverage.report]
fail_under = 100
show_missing = true
skip_covered = true
exclude_also = [
# defensive code
'((case _|if .*|else):\n\s+)?raise AssertionError',
# tests
'((case _|if .*|else):\n\s+)?pytest.fail',
]
[tool.mypy]
strict = true
pretty = true
show_error_codes = true
enable_error_code = ["ignore-without-code"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "conftest.*"
ignore_errors = true
[[tool.ty.overrides]]
rules.all = "ignore"
include = ["tests", "conftest.py"]
[tool.pyright]
# site/ is the docs build output and carries copies of the examples.
ignore = ["tests", "conftest.py", "site"]
[tool.pyrefly]
project-includes = ["src", "typing_tests", "docs/examples"]
project-excludes = ["tests", "conftest.py"]
[tool.ruff]
src = ["src", "tests"]
line-length = 79
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A", # shadowing is fine
"ANN", # Mypy is better at this
"ARG", # unused arguments are fine
"BLE001", # sometimes broad exception handling is intentional
"C901", # leave complexity to me
"CPY", # they expect a very specific shape of a copyright notice
"COM", # Formatter takes care of our commas
"D", # We prefer our own docstring style.
"E501", # leave line-length enforcement to formatter
"FBT001", # occasional booleans are fine
"FBT003", # occasional booleans are fine
"FIX", # Yes, we want XXX as a marker.
"INP001", # sometimes we want Python files outside of packages
"ISC001", # conflicts with formatter
"PLR0911", # leave complexity to me
"PLR0912", # leave complexity to me
"PLR0913", # leave complexity to me
"PLR0915", # leave complexity to me
"PLR0917", # leave complexity to me
"RUF009", # no reason to not use func calls for defaults
"S101", # assert is fine in this codebase
"SLF001", # private members are accessed by friendly functions
"TC", # TYPE_CHECKING breaks runtime-inspection
"TD", # we don't follow other people's todo style
"TRY", # don't care about exception hygiene here
]
[tool.ruff.lint.per-file-ignores]
"*test*" = [
"B018", # useless expression sometimes aren't useless
"EM", # don't care about exceptions hygiene in tests
"PLC1901", # empty strings are falsey but also more specific
"PLR2004", # magic numbers are fine in tests
"PT011", # broad is fine
"PT012", # sometimes a context needs more than 1 line
"RUF012", # we don't do type annotations in tests
"S101", # assert
"S105", # test passwords can be in-source
"S106", # test passwords can be in-source
"S311", # pseudo-random is fine in tests
"SIM117", # split context managers can read better in tests
"SIM300", # Yoda rocks in asserts
"TRY003", # don't care about messages inside of class
]
"docs/examples/*" = [
"T201", # example code legitimately prints to stdout/stderr
"S311", # pseudo-random is fine in examples
"EM", # don't care about exceptions hygiene in examples
]
[tool.ruff.lint.isort]
lines-between-types = 1
lines-after-imports = 2
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "parents"
[tool.ruff.format]
exclude = ["docs/tutorial.md"]
[tool.interrogate]
omit-covered-files = true
verbose = 2
fail-under = 100
whitelist-regex = ["test_.*"]