From 8585dd26cc89afd1b010c50d51d1d31476f2aaec Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Mon, 1 Jun 2026 12:01:16 +0300 Subject: [PATCH] refactor: drop unused abc.ABC from BaseInstrument; document config holders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REF-3: BaseInstrument inherited from abc.ABC but defined no abstract methods. After PR7 made the class generic and removed the # noqa: B027 suppressions, abc.ABC serves no purpose — all four methods (bootstrap, teardown, is_ready, check_dependencies) are concrete no-ops with sensible defaults. Drop the abc.ABC parent and the now- unused `import abc`. BaseBootstrapper still uses abc.ABC (it has real abstract methods: not_ready_message, _prepare_application, is_ready) and is unchanged. REF-5: Add one-line module docstrings to swagger_instrument.py and prometheus_instrument.py explaining that these files hold config and minimal base logic; framework-specific bootstrap behavior lives in the bootstrapper subclasses (FastAPISwaggerInstrument, etc.). These files were left as separate modules per the locked decision in the deferred-refactors sequencing spec. No behavior change. Closes REF-3 and REF-5 from the audit. --- lite_bootstrap/instruments/base.py | 3 +-- lite_bootstrap/instruments/prometheus_instrument.py | 2 ++ lite_bootstrap/instruments/swagger_instrument.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lite_bootstrap/instruments/base.py b/lite_bootstrap/instruments/base.py index bfd44cb..e5fd6f5 100644 --- a/lite_bootstrap/instruments/base.py +++ b/lite_bootstrap/instruments/base.py @@ -1,4 +1,3 @@ -import abc import dataclasses import typing @@ -31,7 +30,7 @@ def from_object(cls, obj: object) -> typing_extensions.Self: @dataclasses.dataclass(kw_only=True, slots=True, frozen=True) -class BaseInstrument(abc.ABC, typing.Generic[ConfigT]): +class BaseInstrument(typing.Generic[ConfigT]): bootstrap_config: ConfigT not_ready_message = "" missing_dependency_message = "" diff --git a/lite_bootstrap/instruments/prometheus_instrument.py b/lite_bootstrap/instruments/prometheus_instrument.py index ccf047f..8bc81c8 100644 --- a/lite_bootstrap/instruments/prometheus_instrument.py +++ b/lite_bootstrap/instruments/prometheus_instrument.py @@ -1,3 +1,5 @@ +"""Prometheus config and readiness check; framework-specific bootstrap lives in the bootstrapper subclasses.""" + import dataclasses from lite_bootstrap.helpers.path import is_valid_path diff --git a/lite_bootstrap/instruments/swagger_instrument.py b/lite_bootstrap/instruments/swagger_instrument.py index 22ef858..f222a98 100644 --- a/lite_bootstrap/instruments/swagger_instrument.py +++ b/lite_bootstrap/instruments/swagger_instrument.py @@ -1,3 +1,5 @@ +"""Swagger config and minimal base instrument; framework-specific behavior lives in the bootstrapper subclasses.""" + import dataclasses from lite_bootstrap.instruments.base import BaseConfig, BaseInstrument