-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
256 lines (245 loc) · 9.93 KB
/
Copy pathpyproject.toml
File metadata and controls
256 lines (245 loc) · 9.93 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
[project]
name = "lite-bootstrap"
description = "Lightweight bootstrap for production-ready Python microservices"
authors = [
{ name = "Artur Shiriev", email = "me@shiriev.ru" },
]
readme = "README.md"
requires-python = ">=3.10,<4"
license = "MIT"
keywords = ["microservices", "bootstrap", "opentelemetry", "sentry", "error-tracing", "fastapi", "litestar", "faststream", "structlog", "fastmcp", "python"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
"Topic :: Software Development :: Libraries",
]
version = "0"
dependencies = [
# Runtime use: `typing_extensions.Self` (base.py) and `typing_extensions.TypedDict`
# (healthchecks) — the latter is required by pydantic/FastAPI on Python < 3.12
# (`typing.TypedDict` is rejected there). Pure Python, so ft-friendly.
# >=4.0 for `Self`; >=4.6 because 4.4 and 4.5 raise on import under Python >=3.12
# (they subclass `typing.TypeVar`). The higher floor wins.
"typing-extensions>=4.6",
]
[project.urls]
Homepage = "https://lite-bootstrap.modern-python.org"
Documentation = "https://lite-bootstrap.modern-python.org"
Repository = "https://github.com/modern-python/lite-bootstrap"
Issues = "https://github.com/modern-python/lite-bootstrap/issues"
Changelog = "https://github.com/modern-python/lite-bootstrap/releases"
[project.optional-dependencies]
orjson = [
# No API forces this floor: only `orjson.dumps(...).decode()` and `orjson.loads`, both original.
# >=3.11.1 is the first release with cp314 wheels, and orjson builds from source only with a
# Rust toolchain (a nightly one, on 3.14), so anything older is uninstallable on the newest
# supported interpreter. 3.11.0 ships none: a machine with cargo installed can still build it,
# which is how #218 came to declare >=3.11.
"orjson>=3.11.1",
]
sentry = [
# >=1.31 for the `max_value_length` init option; >=2.1 for sentry_sdk.set_tags (plural,
# SentryInstrument.bootstrap) -- the higher floor wins.
# 2.1 predates Python 3.13's FrameLocalsProxy, which the SDK fails to pickle when capturing a
# request, and 3.14 needs later fixes again. Marked rather than raised, so 3.10-3.12 keep 2.1.
"sentry-sdk>=2.1; python_version < '3.13'",
"sentry-sdk>=2.11; python_version == '3.13'",
"sentry-sdk>=2.59; python_version >= '3.14'",
]
pyroscope = [
# >=0.7.2 for pyroscope.shutdown() (PyroscopeInstrument.teardown); 0.7.1 and below carry
# configure() without it, so teardown raises rather than failing at import. >=1.0.1 because
# add_thread_tag took (thread_id, key, value) until then and PyroscopeSpanProcessor calls it
# with (key, value) -- reached only when a span starts, so import and bootstrap both look fine.
"pyroscope-io>=1.0.1",
]
otl = [
# One release train: api/sdk/exporters 1.28 pair with every instrumentation package at
# 0.49b0. 0.49b0 is the first that does not import `pkg_resources`, which setuptools no
# longer ships, so anything older fails at import on a fresh install. The exporters carry
# the floor separately: nothing else constrains them, and left bare they resolve 23 minors
# behind the api they must match.
"opentelemetry-api>=1.28",
"opentelemetry-sdk>=1.28",
"opentelemetry-exporter-otlp-proto-grpc>=1.28",
"opentelemetry-instrumentation>=0.49b0",
]
otl-http = [
"opentelemetry-api>=1.28",
"opentelemetry-sdk>=1.28",
"opentelemetry-exporter-otlp-proto-http>=1.28",
"opentelemetry-instrumentation>=0.49b0",
]
logging = [
# >=21.3 for structlog.stdlib.ProcessorFormatter.remove_processors_meta (LoggingInstrument's
# renderer chain). The library reads structlog.typing only under TYPE_CHECKING; the test suite
# imports it for real and needs 22.2, which is declared in [dependency-groups] dev instead.
"structlog>=21.3",
]
free-all = [
"lite-bootstrap[sentry,otl,logging,pyroscope]",
]
fastapi = [
# >=0.112.2 for fastapi.routing._merge_lifespan_context, which FastAPIBootstrapper._wrap_lifespan
# uses to chain teardown onto the user's lifespan. Private, so it can move without a deprecation.
"fastapi>=0.112.2",
]
fastapi-sentry = [
"lite-bootstrap[fastapi,sentry]",
]
fastapi-otl = [
"lite-bootstrap[fastapi,otl]",
"opentelemetry-instrumentation-fastapi>=0.49b0",
]
fastapi-logging = [
"lite-bootstrap[fastapi,logging]",
]
fastapi-metrics = [
"lite-bootstrap[fastapi]",
# >=8.0.1 carries the _IncludedRouter fix required for FastAPI >=0.137
# (trallnag/prometheus-fastapi-instrumentator#370).
"prometheus-fastapi-instrumentator>=8.0.1",
]
fastapi-all = [
"lite-bootstrap[fastapi-sentry,fastapi-otl,fastapi-logging,fastapi-metrics,pyroscope]",
]
litestar = [
# >=2.13 for AppConfig.request_max_body_size (LitestarBootstrapper._apply_config reads it);
# >=2.15 for litestar.middleware.ASGIMiddleware (LitestarOpenTelemetryInstrumentationMiddleware
# subclasses it); >=2.19 because litestar/concurrency.py imports sniffio and only 2.19 declares
# it -- until then it arrived via anyio, which dropped the dependency in 4.14. The highest wins.
"litestar>=2.19",
# litestar declares `typing-extensions` bare while importing typing_extensions.ReadOnly (4.9),
# so the floor has to come from here. >=4.12 rather than 4.9: 4.9 and 4.11 assign
# `typing.ParamSpec.__default__`, which Python 3.13 made read-only.
"typing-extensions>=4.12",
]
litestar-sentry = [
"lite-bootstrap[litestar,sentry]",
]
litestar-otl = [
"lite-bootstrap[litestar,otl]",
# Raised from 0.46b0 with the rest of the train: every instrumentation package pins
# `opentelemetry-instrumentation` to its own exact version, so they move together.
"opentelemetry-instrumentation-asgi>=0.49b0",
]
litestar-logging = [
"lite-bootstrap[litestar,logging]",
# litestar's StructlogPlugin builds a stdlib logging config whose 'standard' formatter
# structlog cannot supply before 23.2, so LitestarBootstrapper raises ValueError during
# bootstrap. Higher than the 21.3 the `logging` extra needs on its own.
"structlog>=23.2",
]
litestar-metrics = [
"lite-bootstrap[litestar]",
"prometheus-client>=0.20",
]
litestar-all = [
"lite-bootstrap[litestar-sentry,litestar-otl,litestar-logging,litestar-metrics,pyroscope]",
]
faststream = [
# >=0.6 for faststream._internal.logger.params_storage.ManualLoggerStorage and for
# broker.config.logger.params_storage (FastStreamLoggingInstrument swaps and restores it).
"faststream>=0.6",
# Not imported here: faststream pulls pydantic through fast-depends[pydantic], which allows it
# back to 1.7.4, and pydantic-core ships no cp314 wheel before pydantic 2.12. Without this the
# lowest declared combination has no installable pydantic on 3.14. Marked, because 2.7.4 is fine
# everywhere else and there is no reason to raise the floor for older interpreters.
"pydantic>=2.12; python_version >= '3.14'",
# pydantic requires typing-extensions>=4.12.2 on 3.13+; without this the lowest declared
# combination pins typing-extensions at 4.8 and drags pydantic back to a build that has no
# cp313 wheel either.
"typing-extensions>=4.12.2",
]
faststream-sentry = [
"lite-bootstrap[faststream,sentry]",
]
faststream-otl = [
"lite-bootstrap[faststream,otl]",
]
faststream-logging = [
"lite-bootstrap[faststream,logging]",
]
faststream-metrics = [
"lite-bootstrap[faststream]",
"prometheus-client>=0.20",
]
faststream-all = [
"lite-bootstrap[faststream-sentry,faststream-otl,faststream-logging,faststream-metrics,pyroscope]",
"lite-bootstrap[sentry,otl,logging,faststream,faststream-metrics,pyroscope]"
]
fastmcp = [
# >=3.0 for fastmcp.server.providers.Provider and FastMCP.add_provider()
# (FastMcpBootstrapper registers its teardown through them --
# docs/adr/0001-fastmcp-teardown-via-provider-lifespan.md).
"fastmcp>=3.0",
]
fastmcp-metrics = [
"lite-bootstrap[fastmcp]",
"prometheus-client>=0.20",
]
fastmcp-all = [
"lite-bootstrap[fastmcp,fastmcp-metrics,sentry,logging,pyroscope]",
]
[dependency-groups]
dev = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"httpx2", # for test client
"redis>=5.2.1",
# conftest imports structlog.typing at runtime, which the library does not. The suite's
# floor is higher than the one the `logging` extra publishes; this is where it belongs.
"structlog>=22.2",
]
lint = [
"ty",
"ruff",
"eof-fixer",
]
[build-system]
requires = ["uv_build<0.12"]
build-backend = "uv_build"
[tool.uv.build-backend]
module-name = "lite_bootstrap"
module-root = ""
[tool.ruff]
fix = true
unsafe-fixes = true
line-length = 120
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"D1", # docstrings are not forced; a docstring exists when it says something
"D203", # conflicts with D211
"D213", # conflicts with D212
"COM812", # conflicts with the formatter
"ISC001", # conflicts with the formatter
"CPY001", # no per-file copyright header
"FBT", # boolean positional arguments are fine
"TCH", # imports stay real; TYPE_CHECKING-only imports break runtime introspection
]
isort.lines-after-imports = 2
isort.no-lines-before = ["standard-library", "local-folder"]
[tool.ruff.lint.per-file-ignores]
"scripts/*.py" = ["INP001", "S101"] # standalone scripts, not an importable package; the smoke test asserts are its checks
"benchmarks/*.py" = ["INP001", "T201", "SLF001"] # standalone scripts: print tables, read SDK internals
"tests/**" = ["S101"]
[tool.pytest.ini_options]
addopts = ""
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.report]
fail_under = 100
exclude_also = [
"if typing.TYPE_CHECKING:",
"except ImportError:"
]