96
96
from django .core .management .base import OutputWrapper as BaseOutputWrapper
97
97
from django .core .management .color import Style as ColorStyle
98
98
from django .db .models import Model
99
- from django .utils .functional import classproperty
99
+ from django .utils .functional import Promise , classproperty
100
100
from django .utils .translation import gettext as _
101
101
102
102
from django_typer import patch
141
141
from typing import ParamSpec
142
142
143
143
144
- VERSION = (2 , 0 , 1 )
144
+ VERSION = (2 , 0 , 2 )
145
145
146
146
__title__ = "Django Typer"
147
147
__version__ = "." .join (str (i ) for i in VERSION )
@@ -741,14 +741,14 @@ def _cache_initializer(
741
741
callback : t .Callable [..., t .Any ],
742
742
common_init : bool ,
743
743
name : t .Optional [str ] = Default (None ),
744
- help : t .Optional [str ] = Default (None ),
744
+ help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
745
745
cls : t .Type [DTGroup ] = DTGroup ,
746
746
** kwargs ,
747
747
):
748
748
def register (
749
749
cmd : "TyperCommand" ,
750
750
_name : t .Optional [str ] = Default (None ),
751
- _help : t .Optional [str ] = Default (None ),
751
+ _help : t .Optional [t . Union [ str , Promise ] ] = Default (None ),
752
752
** extra ,
753
753
):
754
754
return cmd .typer_app .callback (
@@ -769,14 +769,14 @@ def register(
769
769
def _cache_command (
770
770
callback : t .Callable [..., t .Any ],
771
771
name : t .Optional [str ] = None ,
772
- help : t .Optional [str ] = None ,
772
+ help : t .Optional [t . Union [ str , Promise ] ] = None ,
773
773
cls : t .Type [DTCommand ] = DTCommand ,
774
774
** kwargs ,
775
775
):
776
776
def register (
777
777
cmd : "TyperCommand" ,
778
778
_name : t .Optional [str ] = None ,
779
- _help : t .Optional [str ] = None ,
779
+ _help : t .Optional [t . Union [ str , Promise ] ] = None ,
780
780
** extra ,
781
781
):
782
782
return cmd .typer_app .command (
@@ -973,9 +973,9 @@ def __init__(
973
973
# Command
974
974
context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
975
975
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 ),
977
977
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 ),
979
979
options_metavar : str = Default ("[OPTIONS]" ),
980
980
add_help_option : bool = Default (True ),
981
981
hidden : bool = Default (False ),
@@ -1012,9 +1012,9 @@ def __init__(
1012
1012
result_callback = result_callback ,
1013
1013
context_settings = context_settings ,
1014
1014
callback = callback ,
1015
- help = help ,
1015
+ help = t . cast ( str , help ) ,
1016
1016
epilog = epilog ,
1017
- short_help = short_help ,
1017
+ short_help = t . cast ( str , short_help ) ,
1018
1018
options_metavar = options_metavar ,
1019
1019
add_help_option = add_help_option ,
1020
1020
hidden = hidden ,
@@ -1053,9 +1053,9 @@ def callback( # type: ignore
1053
1053
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1054
1054
# Command
1055
1055
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 ),
1057
1057
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 ),
1059
1059
options_metavar : str = Default ("[OPTIONS]" ),
1060
1060
add_help_option : bool = Default (True ),
1061
1061
hidden : bool = Default (False ),
@@ -1088,9 +1088,9 @@ def make_callback(
1088
1088
result_callback = result_callback ,
1089
1089
context_settings = context_settings ,
1090
1090
callback = func ,
1091
- help = help ,
1091
+ help = t . cast ( str , help ) ,
1092
1092
epilog = epilog ,
1093
- short_help = short_help ,
1093
+ short_help = t . cast ( str , short_help ) ,
1094
1094
options_metavar = options_metavar ,
1095
1095
add_help_option = add_help_option ,
1096
1096
hidden = hidden ,
@@ -1110,9 +1110,9 @@ def command( # type: ignore
1110
1110
* ,
1111
1111
cls : t .Type [DTCommand ] = DTCommand ,
1112
1112
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 ,
1114
1114
epilog : t .Optional [str ] = None ,
1115
- short_help : t .Optional [str ] = None ,
1115
+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
1116
1116
options_metavar : str = "[OPTIONS]" ,
1117
1117
add_help_option : bool = True ,
1118
1118
no_args_is_help : bool = False ,
@@ -1178,9 +1178,9 @@ def make_command(func: t.Callable[P2, R2]) -> t.Callable[P2, R2]:
1178
1178
"_Command" , (cls ,), {"django_command" : self .django_command }
1179
1179
),
1180
1180
context_settings = context_settings ,
1181
- help = help ,
1181
+ help = t . cast ( str , help ) ,
1182
1182
epilog = epilog ,
1183
- short_help = short_help ,
1183
+ short_help = t . cast ( str , short_help ) ,
1184
1184
options_metavar = options_metavar ,
1185
1185
add_help_option = add_help_option ,
1186
1186
no_args_is_help = no_args_is_help ,
@@ -1207,9 +1207,9 @@ def add_typer( # type: ignore
1207
1207
# Command
1208
1208
context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1209
1209
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 ),
1211
1211
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 ),
1213
1213
options_metavar : str = Default ("[OPTIONS]" ),
1214
1214
add_help_option : bool = Default (True ),
1215
1215
hidden : bool = Default (False ),
@@ -1232,9 +1232,9 @@ def add_typer( # type: ignore
1232
1232
result_callback = result_callback ,
1233
1233
context_settings = context_settings ,
1234
1234
callback = _strip_static (callback ),
1235
- help = help ,
1235
+ help = t . cast ( str , help ) ,
1236
1236
epilog = epilog ,
1237
- short_help = short_help ,
1237
+ short_help = t . cast ( str , short_help ) ,
1238
1238
options_metavar = options_metavar ,
1239
1239
add_help_option = add_help_option ,
1240
1240
hidden = hidden ,
@@ -1254,9 +1254,9 @@ def group(
1254
1254
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1255
1255
# Command
1256
1256
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
1258
1258
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 ),
1260
1260
options_metavar : str = Default ("[OPTIONS]" ),
1261
1261
add_help_option : bool = Default (True ),
1262
1262
hidden : bool = Default (False ),
@@ -1392,9 +1392,9 @@ def initialize(
1392
1392
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1393
1393
# Command
1394
1394
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
1396
1396
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 ),
1398
1398
options_metavar : str = Default ("[OPTIONS]" ),
1399
1399
add_help_option : bool = Default (True ),
1400
1400
hidden : bool = Default (False ),
@@ -1531,9 +1531,9 @@ def command( # pylint: disable=keyword-arg-before-vararg
1531
1531
* ,
1532
1532
cls : t .Type [DTCommand ] = DTCommand ,
1533
1533
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
1535
1535
epilog : t .Optional [str ] = None ,
1536
- short_help : t .Optional [str ] = None ,
1536
+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
1537
1537
options_metavar : str = "[OPTIONS]" ,
1538
1538
add_help_option : bool = True ,
1539
1539
no_args_is_help : bool = False ,
@@ -1633,9 +1633,9 @@ def group(
1633
1633
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1634
1634
# Command
1635
1635
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
1637
1637
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 ),
1639
1639
options_metavar : str = Default ("[OPTIONS]" ),
1640
1640
add_help_option : bool = Default (True ),
1641
1641
hidden : bool = Default (False ),
@@ -1950,9 +1950,9 @@ def __new__(
1950
1950
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
1951
1951
context_settings : t .Optional [t .Dict [t .Any , t .Any ]] = Default (None ),
1952
1952
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
1954
1954
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 ),
1956
1956
options_metavar : str = Default ("[OPTIONS]" ),
1957
1957
add_help_option : bool = Default (True ),
1958
1958
hidden : bool = Default (False ),
@@ -2539,7 +2539,7 @@ def command2(self, option: t.Optional[str] = None):
2539
2539
_help_kwarg : t .Optional [str ] = Default (None )
2540
2540
_defined_groups : t .Dict [str , Typer ] = {}
2541
2541
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
2543
2543
2544
2544
# allow deriving commands to override handle() from BaseCommand
2545
2545
# without triggering static type checking complaints
@@ -2570,9 +2570,9 @@ def initialize(
2570
2570
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
2571
2571
# Command
2572
2572
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
2574
2574
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 ),
2576
2576
options_metavar : str = Default ("[OPTIONS]" ),
2577
2577
add_help_option : bool = Default (True ),
2578
2578
hidden : bool = Default (False ),
@@ -2679,9 +2679,9 @@ def command(
2679
2679
* ,
2680
2680
cls : t .Type [DTCommand ] = DTCommand ,
2681
2681
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
2683
2683
epilog : t .Optional [str ] = None ,
2684
- short_help : t .Optional [str ] = None ,
2684
+ short_help : t .Optional [t . Union [ str , Promise ] ] = None ,
2685
2685
options_metavar : str = "[OPTIONS]" ,
2686
2686
add_help_option : bool = True ,
2687
2687
no_args_is_help : bool = False ,
@@ -2778,9 +2778,9 @@ def group(
2778
2778
result_callback : t .Optional [t .Callable [..., t .Any ]] = Default (None ),
2779
2779
# Command
2780
2780
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
2782
2782
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 ),
2784
2784
options_metavar : str = Default ("[OPTIONS]" ),
2785
2785
add_help_option : bool = Default (True ),
2786
2786
hidden : bool = Default (False ),
0 commit comments