Skip to content

Commit 176cbae

Browse files
authored
fix: silence ty 0.0.87 override checks on instrument bootstrap_config (#284)
1 parent caa79ab commit 176cbae

6 files changed

Lines changed: 26 additions & 26 deletions

File tree

‎lite_bootstrap/bootstrappers/fastapi_bootstrapper.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def send_wrapper(message: "Message") -> None:
156156

157157
@dataclasses.dataclass(kw_only=True)
158158
class FastAPILoggingInstrument(LoggingInstrument):
159-
bootstrap_config: FastAPIConfig
159+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
160160

161161
def bootstrap(self) -> None:
162162
super().bootstrap()
@@ -167,15 +167,15 @@ def bootstrap(self) -> None:
167167

168168
@dataclasses.dataclass(kw_only=True, slots=True)
169169
class FastAPICorsInstrument(CorsInstrument):
170-
bootstrap_config: FastAPIConfig
170+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
171171

172172
def bootstrap(self) -> None:
173173
self.bootstrap_config.app.add_middleware(CORSMiddleware, **self.cors_kwargs)
174174

175175

176176
@dataclasses.dataclass(kw_only=True, slots=True)
177177
class FastAPIHealthChecksInstrument(HealthChecksInstrument):
178-
bootstrap_config: FastAPIConfig
178+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
179179

180180
def build_fastapi_health_check_router(self) -> "fastapi.APIRouter":
181181
fastapi_router = fastapi.APIRouter(
@@ -195,7 +195,7 @@ def bootstrap(self) -> None:
195195

196196
@dataclasses.dataclass(kw_only=True)
197197
class FastAPIOpenTelemetryInstrument(OpenTelemetryInstrument):
198-
bootstrap_config: FastAPIConfig
198+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
199199

200200
def bootstrap(self) -> None:
201201
super().bootstrap()
@@ -214,7 +214,7 @@ def teardown(self) -> None:
214214

215215
@dataclasses.dataclass(kw_only=True)
216216
class FastAPIPrometheusInstrument(PrometheusInstrument):
217-
bootstrap_config: FastAPIConfig
217+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
218218
missing_dependency_message = "prometheus_fastapi_instrumentator is not installed"
219219

220220
@staticmethod
@@ -237,7 +237,7 @@ def bootstrap(self) -> None:
237237

238238
@dataclasses.dataclass(kw_only=True)
239239
class FastAPISwaggerInstrument(SwaggerInstrument):
240-
bootstrap_config: FastAPIConfig
240+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
241241

242242
def bootstrap(self) -> None:
243243
config = self.bootstrap_config
@@ -261,7 +261,7 @@ class FastAPIBootstrapper(BaseBootstrapper["fastapi.FastAPI"]):
261261
FastAPIPrometheusInstrument,
262262
FastAPISwaggerInstrument,
263263
]
264-
bootstrap_config: FastAPIConfig
264+
bootstrap_config: FastAPIConfig # ty: ignore[invalid-mutable-override]
265265
not_ready_message = "fastapi is not installed"
266266

267267
@contextlib.asynccontextmanager

‎lite_bootstrap/bootstrappers/fastmcp_bootstrapper.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class FastMcpConfig(
200200

201201
@dataclasses.dataclass(kw_only=True)
202202
class FastMcpHealthChecksInstrument(HealthChecksInstrument):
203-
bootstrap_config: FastMcpConfig
203+
bootstrap_config: FastMcpConfig # ty: ignore[invalid-mutable-override]
204204

205205
def bootstrap(self) -> None:
206206
config = self.bootstrap_config
@@ -217,7 +217,7 @@ async def health_check_handler(_: "Request") -> "JSONResponse":
217217

218218
@dataclasses.dataclass(kw_only=True)
219219
class FastMcpOpenTelemetryInstrument(OpenTelemetryInstrument):
220-
bootstrap_config: FastMcpConfig
220+
bootstrap_config: FastMcpConfig # ty: ignore[invalid-mutable-override]
221221
missing_dependency_message = "opentelemetry-instrumentation-asgi is not installed"
222222
_restore_http_app: typing.Callable[[], None] | None = dataclasses.field(
223223
default=None, init=False, repr=False, compare=False
@@ -258,7 +258,7 @@ def teardown(self) -> None:
258258

259259
@dataclasses.dataclass(kw_only=True)
260260
class FastMcpPrometheusInstrument(PrometheusInstrument):
261-
bootstrap_config: FastMcpConfig
261+
bootstrap_config: FastMcpConfig # ty: ignore[invalid-mutable-override]
262262
missing_dependency_message = "prometheus_client or prometheus_fastapi_instrumentator is not installed"
263263
_restore_http_app: typing.Callable[[], None] | None = dataclasses.field(
264264
default=None, init=False, repr=False, compare=False
@@ -320,7 +320,7 @@ def teardown(self) -> None:
320320

321321
@dataclasses.dataclass(kw_only=True)
322322
class FastMcpLoggingInstrument(LoggingInstrument):
323-
bootstrap_config: FastMcpConfig
323+
bootstrap_config: FastMcpConfig # ty: ignore[invalid-mutable-override]
324324

325325
def bootstrap(self) -> None:
326326
super().bootstrap()
@@ -340,7 +340,7 @@ class FastMcpBootstrapper(BaseBootstrapper["FastMCP[typing.Any]"]):
340340
FastMcpLoggingInstrument,
341341
FastMcpPrometheusInstrument,
342342
]
343-
bootstrap_config: FastMcpConfig
343+
bootstrap_config: FastMcpConfig # ty: ignore[invalid-mutable-override]
344344
not_ready_message = "fastmcp is not installed"
345345

346346
def is_ready(self) -> bool:

‎lite_bootstrap/bootstrappers/faststream_bootstrapper.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class FastStreamConfig(
8282

8383
@dataclasses.dataclass(kw_only=True, slots=True)
8484
class FastStreamHealthChecksInstrument(HealthChecksInstrument):
85-
bootstrap_config: FastStreamConfig
85+
bootstrap_config: FastStreamConfig # ty: ignore[invalid-mutable-override]
8686

8787
def bootstrap(self) -> None:
8888
config = self.bootstrap_config
@@ -114,7 +114,7 @@ async def _define_health_status(self) -> bool:
114114

115115
@dataclasses.dataclass(kw_only=True)
116116
class FastStreamLoggingInstrument(LoggingInstrument):
117-
bootstrap_config: FastStreamConfig
117+
bootstrap_config: FastStreamConfig # ty: ignore[invalid-mutable-override]
118118
_prior_broker_params_storage: typing.Any = dataclasses.field(default=None, init=False, repr=False, compare=False)
119119
_broker_logger_replaced: bool = dataclasses.field(default=False, init=False, repr=False, compare=False)
120120

@@ -142,7 +142,7 @@ def teardown(self) -> None:
142142

143143
@dataclasses.dataclass(kw_only=True)
144144
class FastStreamOpenTelemetryInstrument(OpenTelemetryInstrument):
145-
bootstrap_config: FastStreamConfig
145+
bootstrap_config: FastStreamConfig # ty: ignore[invalid-mutable-override]
146146

147147
def bootstrap(self) -> None:
148148
super().bootstrap()
@@ -161,7 +161,7 @@ def _make_collector_registry() -> "prometheus_client.CollectorRegistry":
161161

162162
@dataclasses.dataclass(kw_only=True)
163163
class FastStreamPrometheusInstrument(PrometheusInstrument):
164-
bootstrap_config: FastStreamConfig
164+
bootstrap_config: FastStreamConfig # ty: ignore[invalid-mutable-override]
165165
collector_registry: "prometheus_client.CollectorRegistry" = dataclasses.field(init=False)
166166
not_configured_reason = (
167167
PrometheusInstrument.not_configured_reason
@@ -204,7 +204,7 @@ class FastStreamBootstrapper(BaseBootstrapper["AsgiFastStream"]):
204204
FastStreamLoggingInstrument,
205205
FastStreamPrometheusInstrument,
206206
]
207-
bootstrap_config: FastStreamConfig
207+
bootstrap_config: FastStreamConfig # ty: ignore[invalid-mutable-override]
208208
not_ready_message = "faststream is not installed"
209209

210210
def is_ready(self) -> bool:

‎lite_bootstrap/bootstrappers/free_bootstrapper.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FreeBootstrapper(BaseBootstrapper[None]):
2121
OpenTelemetryInstrument,
2222
PyroscopeInstrument,
2323
]
24-
bootstrap_config: FreeConfig
24+
bootstrap_config: FreeConfig # ty: ignore[invalid-mutable-override]
2525
not_ready_message = ""
2626

2727
def is_ready(self) -> bool:

‎lite_bootstrap/bootstrappers/litestar_bootstrapper.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ def __post_init__(self) -> None:
140140

141141
@dataclasses.dataclass(kw_only=True, slots=True)
142142
class LitestarCorsInstrument(CorsInstrument):
143-
bootstrap_config: LitestarConfig
143+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
144144

145145
def bootstrap(self) -> None:
146146
self.bootstrap_config.application_config.cors_config = CORSConfig(**self.cors_kwargs)
147147

148148

149149
@dataclasses.dataclass(kw_only=True, slots=True)
150150
class LitestarHealthChecksInstrument(HealthChecksInstrument):
151-
bootstrap_config: LitestarConfig
151+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
152152

153153
def build_litestar_health_check_router(self) -> "litestar.Router":
154154
@litestar.get(media_type=litestar.MediaType.JSON)
@@ -168,7 +168,7 @@ def bootstrap(self) -> None:
168168

169169
@dataclasses.dataclass(kw_only=True)
170170
class LitestarLoggingInstrument(LoggingInstrument):
171-
bootstrap_config: LitestarConfig
171+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
172172

173173
def _build_logging_middleware_excluded_paths(self) -> list[str]:
174174
"""Regex-escaped path prefixes for infrastructure routes not worth an access log line."""
@@ -210,7 +210,7 @@ def _configure_structlog_loggers(self) -> None:
210210

211211
@dataclasses.dataclass(kw_only=True)
212212
class LitestarOpenTelemetryInstrument(OpenTelemetryInstrument):
213-
bootstrap_config: LitestarConfig
213+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
214214
missing_dependency_message = "opentelemetry-instrumentation-asgi or litestar>=2.22 is not installed"
215215

216216
@staticmethod
@@ -252,7 +252,7 @@ def bootstrap(self) -> None:
252252

253253
@dataclasses.dataclass(kw_only=True)
254254
class LitestarPrometheusInstrument(PrometheusInstrument):
255-
bootstrap_config: LitestarConfig
255+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
256256
missing_dependency_message = "prometheus_client is not installed"
257257

258258
@staticmethod
@@ -280,7 +280,7 @@ class LitestarPrometheusController(PrometheusController):
280280

281281
@dataclasses.dataclass(kw_only=True)
282282
class LitestarSwaggerInstrument(SwaggerInstrument):
283-
bootstrap_config: LitestarConfig
283+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
284284
not_configured_reason = "swagger_path is empty or not valid"
285285

286286
@classmethod
@@ -328,7 +328,7 @@ class LitestarBootstrapper(BaseBootstrapper["litestar.Litestar"]):
328328
LitestarPrometheusInstrument,
329329
LitestarSwaggerInstrument,
330330
]
331-
bootstrap_config: LitestarConfig
331+
bootstrap_config: LitestarConfig # ty: ignore[invalid-mutable-override]
332332
not_ready_message = "litestar is not installed"
333333

334334
def __init__(self, bootstrap_config: LitestarConfig) -> None:

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ lint = [
232232
]
233233

234234
[build-system]
235-
requires = ["uv_build<0.12"]
235+
requires = ["uv_build>=0.11,<1.0"]
236236
build-backend = "uv_build"
237237

238238
[tool.uv.build-backend]

0 commit comments

Comments
 (0)