33from collections .abc import Mapping
44
55from lite_bootstrap .exceptions import ConfigurationError
6- from lite_bootstrap .helpers .warn import warn_at_caller
6+ from lite_bootstrap .helpers .warn import NEXT_MAJOR_VERSION , warn_at_caller
77from lite_bootstrap .types import UNSET , UnsetType
88
99
@@ -40,7 +40,8 @@ def __post_init__(self) -> None:
4040 msg = f"{ old_name } and { new_name } are both set; { old_name } is deprecated, set only { new_name } ."
4141 raise ConfigurationError (msg )
4242 warn_at_caller (
43- f"{ old_name } is deprecated and will be removed in lite-bootstrap 2.0; use { new_name } instead." ,
43+ f"{ old_name } is deprecated and will be removed in lite-bootstrap { NEXT_MAJOR_VERSION } ; "
44+ f"use { new_name } instead." ,
4445 category = DeprecationWarning ,
4546 )
4647 object .__setattr__ (self , new_name , old_value )
@@ -63,31 +64,12 @@ def from_object(cls, obj: object) -> typing.Self:
6364ConfigT = typing .TypeVar ("ConfigT" , bound = BaseConfig )
6465
6566
66- # Legacy name -> current name; __init_subclass__ forwards an out-of-tree instrument's old spelling.
67- _RENAMED_ATTRIBUTES : typing .Final = {
68- "not_ready_message" : "not_configured_reason" ,
69- "check_dependencies" : "dependencies_installed" ,
70- }
71-
72-
7367@dataclasses .dataclass (kw_only = True , slots = True )
7468class BaseInstrument (typing .Generic [ConfigT ]):
7569 bootstrap_config : ConfigT
7670 not_configured_reason = ""
7771 missing_dependency_message = ""
7872
79- def __init_subclass__ (cls , ** kwargs : object ) -> None :
80- # @dataclass(slots=True) replaces the class object, breaking bare super().
81- super (BaseInstrument , cls ).__init_subclass__ (** kwargs )
82- for legacy_name , current_name in _RENAMED_ATTRIBUTES .items ():
83- if legacy_name in cls .__dict__ and current_name not in cls .__dict__ :
84- warn_at_caller (
85- f"{ cls .__name__ } .{ legacy_name } is deprecated and will be removed in lite-bootstrap 2.0; "
86- f"use { current_name } instead." ,
87- category = DeprecationWarning ,
88- )
89- setattr (cls , current_name , cls .__dict__ [legacy_name ])
90-
9173 def bootstrap (self ) -> None : ...
9274
9375 def teardown (self ) -> None : ...
0 commit comments