1515import  pathlib 
1616import  re 
1717import  typing 
18+ import  warnings 
1819from  dataclasses  import  asdict , dataclass , field 
1920from  datetime  import  datetime 
2021from  enum  import  Enum 
@@ -897,6 +898,7 @@ class runopt:
897898    is_required : bool 
898899    help : str 
899900    aliases : Optional [List [str ]] =  None 
901+     deprecated_aliases : Optional [List [str ]] =  None 
900902
901903    @property  
902904    def  is_type_list_of_str (self ) ->  bool :
@@ -1037,12 +1039,21 @@ def resolve(self, cfg: Mapping[str, CfgVal]) -> Dict[str, CfgVal]:
10371039            if  val  is  not None :
10381040                if  cfg_key  not  in cfg_keys_checked :
10391041                    cfg_keys_checked .update (runopt .aliases  or  [])
1042+                     if  runopt .deprecated_aliases  is  not None :
1043+                         for  alias  in  runopt .deprecated_aliases  or  []:
1044+                             if  alias  in  resolved_cfg :
1045+                                 warnings .warn (
1046+                                     f"Run option: { cfg_key }  ,
1047+                                     DeprecationWarning ,
1048+                                     stacklevel = 2 ,
1049+                                 )
10401050                else :
10411051                    raise  InvalidRunConfigException (
10421052                        f"Run option: { cfg_key }  ,
10431053                        cfg_key ,
10441054                        cfg ,
10451055                    )
1056+ 
10461057            # check required opt 
10471058            if  runopt .is_required  and  val  is  None :
10481059                raise  InvalidRunConfigException (
@@ -1161,6 +1172,7 @@ def add(
11611172        help : str ,
11621173        default : CfgVal  =  None ,
11631174        required : bool  =  False ,
1175+         deprecated_aliases : Optional [List [str ]] =  None ,
11641176    ) ->  None :
11651177        """ 
11661178        Adds the ``config`` option with the given help string and ``default`` 
@@ -1178,7 +1190,7 @@ def add(
11781190                    f"Option: { cfg_key } { type_ }  
11791191                    f" Given: { default } { type (default ).__name__ }  
11801192                )
1181-         opt  =  runopt (default , type_ , required , help , aliases )
1193+         opt  =  runopt (default , type_ , required , help , aliases ,  deprecated_aliases )
11821194        for  alias  in  aliases :
11831195            if  alias  in  self ._opts :
11841196                raise  ValueError (
0 commit comments