You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the base instruments generic over their config type and drop the instrument bootstrap_config ignores #285
ty 0.0.87 reports invalid-mutable-override wherever a subclass narrows bootstrap_config. #284 silenced the 25 sites with per-line ignores. They fall into two groups.
Framework instruments (20 ignores)
BaseInstrument is already generic over ConfigT, but each base instrument fixes the parameter (CorsInstrument(BaseInstrument[CorsConfig])). A framework instrument then has to re-annotate the field to get its own config type:
This applies to the Cors, HealthChecks, Logging, OpenTelemetry, Prometheus and Swagger instruments. It works with slotted dataclasses, passes ty 0.0.87 without the ignore, and changes nothing at runtime. An out-of-tree subclass of CorsInstrument keeps working; ty just sees its config type as unknown until it binds the parameter.
Bootstrappers (5 ignores, out of scope)
FastAPIBootstrapper and the other four bootstrappers narrow BaseBootstrapper.bootstrap_config: BaseConfig the same way. Adding a config parameter to BaseBootstrapper breaks every one-argument subscription: BaseBootstrapper[App] raises TypeError: Too few arguments at import, including in tests/instruments/test_logging_record_filters.py.
A default (typing_extensions.TypeVar("ConfigT", bound=BaseConfig, default=BaseConfig)) keeps BaseBootstrapper[App] working on 3.11 and 3.14 (checked with typing-extensions 4.12.2 and 4.15). It would raise the typing-extensions floor from 4.6 to 4.12, though, and the stdlib only has TypeVar defaults from 3.13, so #272 couldn't drop typing-extensions after 3.11's EOL. These 5 ignores stay until 3.13 is the floor or a major release allows the break.
changed the title [-]Make instruments generic over their config type and drop the bootstrap_config ignores[/-][+]Make the base instruments generic over their config type and drop the instrument bootstrap_config ignores[/+]on Oct 14, 2026
Activity
[-]Make instruments generic over their config type and drop the bootstrap_config ignores[/-][+]Make the base instruments generic over their config type and drop the instrument bootstrap_config ignores[/+]