9696from django .core .management .base import OutputWrapper as BaseOutputWrapper
9797from django .core .management .color import Style as ColorStyle
9898from django .db .models import Model
99- from django .utils .functional import classproperty
99+ from django .utils .functional import Promise , classproperty
100100from django .utils .translation import gettext as _
101101
102102from django_typer import patch
141141 from typing import ParamSpec
142142
143143
144- VERSION = (2 , 0 , 1 )
144+ VERSION = (2 , 0 , 2 )
145145
146146__title__ = "Django Typer"
147147__version__ = "." .join (str (i ) for i in VERSION )
@@ -741,14 +741,14 @@ def _cache_initializer(
741741 callback : t .Callable [..., t .Any ],
742742 common_init : bool ,
743743 name : t .Optional [str ] = Default (None ),
744- help : t .Optional [str ] = Default (None ),
744+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
745745 cls : t .Type [DTGroup ] = DTGroup ,
746746 ** kwargs ,
747747):
748748 def register (
749749 cmd : "TyperCommand" ,
750750 _name : t .Optional [str ] = Default (None ),
751- _help : t .Optional [str ] = Default (None ),
751+ _help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
752752 ** extra ,
753753 ):
754754 return cmd .typer_app .callback (
@@ -769,14 +769,14 @@ def register(
769769def _cache_command (
770770 callback : t .Callable [..., t .Any ],
771771 name : t .Optional [str ] = None ,
772- help : t .Optional [str ] = None ,
772+ help : t .Optional [t . Union [ str , Promise ] ] = None ,
773773 cls : t .Type [DTCommand ] = DTCommand ,
774774 ** kwargs ,
775775):
776776 def register (
777777 cmd : "TyperCommand" ,
778778 _name : t .Optional [str ] = None ,
779- _help : t .Optional [str ] = None ,
779+ _help : t .Optional [t . Union [ str , Promise ] ] = None ,
780780 ** extra ,
781781 ):
782782 return cmd .typer_app .command (
@@ -973,9 +973,9 @@ def __init__(
973973 # Command
974974 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
975975 callback : t .Optional [t .Callable [P , R ]] = Default (None ),
976- help : t .Optional [str ] = Default (None ),
976+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
977977 epilog : t .Optional [str ] = Default (None ),
978- short_help : t .Optional [str ] = Default (None ),
978+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
979979 options_metavar : str = Default ("[OPTIONS]" ),
980980 add_help_option : bool = Default (True ),
981981 hidden : bool = Default (False ),
@@ -1012,9 +1012,9 @@ def __init__(
10121012 result_callback = result_callback ,
10131013 context_settings = context_settings ,
10141014 callback = callback ,
1015- help = help ,
1015+ help = t . cast ( str , help ) ,
10161016 epilog = epilog ,
1017- short_help = short_help ,
1017+ short_help = t . cast ( str , short_help ) ,
10181018 options_metavar = options_metavar ,
10191019 add_help_option = add_help_option ,
10201020 hidden = hidden ,
@@ -1053,9 +1053,9 @@ def callback( # type: ignore
10531053 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
10541054 # Command
10551055 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1056- help : t .Optional [str ] = Default (None ),
1056+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
10571057 epilog : t .Optional [str ] = Default (None ),
1058- short_help : t .Optional [str ] = Default (None ),
1058+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
10591059 options_metavar : str = Default ("[OPTIONS]" ),
10601060 add_help_option : bool = Default (True ),
10611061 hidden : bool = Default (False ),
@@ -1088,9 +1088,9 @@ def make_callback(
10881088 result_callback = result_callback ,
10891089 context_settings = context_settings ,
10901090 callback = func ,
1091- help = help ,
1091+ help = t . cast ( str , help ) ,
10921092 epilog = epilog ,
1093- short_help = short_help ,
1093+ short_help = t . cast ( str , short_help ) ,
10941094 options_metavar = options_metavar ,
10951095 add_help_option = add_help_option ,
10961096 hidden = hidden ,
@@ -1110,9 +1110,9 @@ def command( # type: ignore
11101110 * ,
11111111 cls : t .Type [DTCommand ] = DTCommand ,
11121112 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = None ,
1113- help : t .Optional [str ] = None ,
1113+ help : t .Optional [t . Union [ str , Promise ] ] = None ,
11141114 epilog : t .Optional [str ] = None ,
1115- short_help : t .Optional [str ] = None ,
1115+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
11161116 options_metavar : str = "[OPTIONS]" ,
11171117 add_help_option : bool = True ,
11181118 no_args_is_help : bool = False ,
@@ -1178,9 +1178,9 @@ def make_command(func: t.Callable[P2, R2]) -> t.Callable[P2, R2]:
11781178 "_Command" , (cls ,), {"django_command" : self .django_command }
11791179 ),
11801180 context_settings = context_settings ,
1181- help = help ,
1181+ help = t . cast ( str , help ) ,
11821182 epilog = epilog ,
1183- short_help = short_help ,
1183+ short_help = t . cast ( str , short_help ) ,
11841184 options_metavar = options_metavar ,
11851185 add_help_option = add_help_option ,
11861186 no_args_is_help = no_args_is_help ,
@@ -1207,9 +1207,9 @@ def add_typer( # type: ignore
12071207 # Command
12081208 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
12091209 callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1210- help : t .Optional [str ] = Default (None ),
1210+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
12111211 epilog : t .Optional [str ] = Default (None ),
1212- short_help : t .Optional [str ] = Default (None ),
1212+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
12131213 options_metavar : str = Default ("[OPTIONS]" ),
12141214 add_help_option : bool = Default (True ),
12151215 hidden : bool = Default (False ),
@@ -1232,9 +1232,9 @@ def add_typer( # type: ignore
12321232 result_callback = result_callback ,
12331233 context_settings = context_settings ,
12341234 callback = _strip_static (callback ),
1235- help = help ,
1235+ help = t . cast ( str , help ) ,
12361236 epilog = epilog ,
1237- short_help = short_help ,
1237+ short_help = t . cast ( str , short_help ) ,
12381238 options_metavar = options_metavar ,
12391239 add_help_option = add_help_option ,
12401240 hidden = hidden ,
@@ -1254,9 +1254,9 @@ def group(
12541254 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
12551255 # Command
12561256 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1257- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
1257+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
12581258 epilog : t .Optional [str ] = Default (None ),
1259- short_help : t .Optional [str ] = Default (None ),
1259+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
12601260 options_metavar : str = Default ("[OPTIONS]" ),
12611261 add_help_option : bool = Default (True ),
12621262 hidden : bool = Default (False ),
@@ -1392,9 +1392,9 @@ def initialize(
13921392 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
13931393 # Command
13941394 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1395- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
1395+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
13961396 epilog : t .Optional [str ] = Default (None ),
1397- short_help : t .Optional [str ] = Default (None ),
1397+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
13981398 options_metavar : str = Default ("[OPTIONS]" ),
13991399 add_help_option : bool = Default (True ),
14001400 hidden : bool = Default (False ),
@@ -1531,9 +1531,9 @@ def command( # pylint: disable=keyword-arg-before-vararg
15311531 * ,
15321532 cls : t .Type [DTCommand ] = DTCommand ,
15331533 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = None ,
1534- help : t .Optional [str ] = None , # pylint: disable=redefined-builtin
1534+ help : t .Optional [t . Union [ str , Promise ] ] = None , # pylint: disable=redefined-builtin
15351535 epilog : t .Optional [str ] = None ,
1536- short_help : t .Optional [str ] = None ,
1536+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
15371537 options_metavar : str = "[OPTIONS]" ,
15381538 add_help_option : bool = True ,
15391539 no_args_is_help : bool = False ,
@@ -1633,9 +1633,9 @@ def group(
16331633 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
16341634 # Command
16351635 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1636- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
1636+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
16371637 epilog : t .Optional [str ] = Default (None ),
1638- short_help : t .Optional [str ] = Default (None ),
1638+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
16391639 options_metavar : str = Default ("[OPTIONS]" ),
16401640 add_help_option : bool = Default (True ),
16411641 hidden : bool = Default (False ),
@@ -1950,9 +1950,9 @@ def __new__(
19501950 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
19511951 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
19521952 callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1953- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
1953+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
19541954 epilog : t .Optional [str ] = Default (None ),
1955- short_help : t .Optional [str ] = Default (None ),
1955+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
19561956 options_metavar : str = Default ("[OPTIONS]" ),
19571957 add_help_option : bool = Default (True ),
19581958 hidden : bool = Default (False ),
@@ -2539,7 +2539,7 @@ def command2(self, option: t.Optional[str] = None):
25392539 _help_kwarg : t .Optional [str ] = Default (None )
25402540 _defined_groups : t .Dict [str , Typer ] = {}
25412541
2542- help : t .Optional [t .Union [DefaultPlaceholder , str ]] = Default (None ) # type: ignore
2542+ help : t .Optional [t .Union [DefaultPlaceholder , str , Promise ]] = Default (None ) # type: ignore
25432543
25442544 # allow deriving commands to override handle() from BaseCommand
25452545 # without triggering static type checking complaints
@@ -2570,9 +2570,9 @@ def initialize(
25702570 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
25712571 # Command
25722572 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
2573- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
2573+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
25742574 epilog : t .Optional [str ] = Default (None ),
2575- short_help : t .Optional [str ] = Default (None ),
2575+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
25762576 options_metavar : str = Default ("[OPTIONS]" ),
25772577 add_help_option : bool = Default (True ),
25782578 hidden : bool = Default (False ),
@@ -2679,9 +2679,9 @@ def command(
26792679 * ,
26802680 cls : t .Type [DTCommand ] = DTCommand ,
26812681 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = None ,
2682- help : t .Optional [str ] = None , # pylint: disable=redefined-builtin
2682+ help : t .Optional [t . Union [ str , Promise ] ] = None , # pylint: disable=redefined-builtin
26832683 epilog : t .Optional [str ] = None ,
2684- short_help : t .Optional [str ] = None ,
2684+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
26852685 options_metavar : str = "[OPTIONS]" ,
26862686 add_help_option : bool = True ,
26872687 no_args_is_help : bool = False ,
@@ -2778,9 +2778,9 @@ def group(
27782778 result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
27792779 # Command
27802780 context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
2781- help : t .Optional [str ] = Default (None ), # pylint: disable=redefined-builtin
2781+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ), # pylint: disable=redefined-builtin
27822782 epilog : t .Optional [str ] = Default (None ),
2783- short_help : t .Optional [str ] = Default (None ),
2783+ short_help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
27842784 options_metavar : str = Default ("[OPTIONS]" ),
27852785 add_help_option : bool = Default (True ),
27862786 hidden : bool = Default (False ),
0 commit comments