@@ -133,6 +133,40 @@ def wrapper(*args, **kwargs):
133133 return wrapper
134134
135135
136+ def shinyapps_args (func ):
137+ @click .option (
138+ "--account" ,
139+ "-A" ,
140+ envvar = "SHINYAPPS_ACCOUNT" ,
141+ help = "The shinyapps.io account name." ,
142+ )
143+ @click .option (
144+ "--token" ,
145+ "-T" ,
146+ envvar = "SHINYAPPS_TOKEN" ,
147+ help = "The shinyapps.io token." ,
148+ )
149+ @click .option (
150+ "--secret" ,
151+ "-S" ,
152+ envvar = "SHINYAPPS_SECRET" ,
153+ help = "The shinyapps.io token secret." ,
154+ )
155+ @functools .wraps (func )
156+ def wrapper (* args , ** kwargs ):
157+ return func (* args , ** kwargs )
158+
159+ return wrapper
160+
161+
162+ def _passthrough (func ):
163+ @functools .wraps (func )
164+ def wrapper (* args , ** kwargs ):
165+ return func (* args , ** kwargs )
166+
167+ return wrapper
168+
169+
136170def validate_env_vars (ctx , param , all_values ):
137171 vars = {}
138172
@@ -280,24 +314,7 @@ def _test_shinyappsio_creds(server: api.ShinyappsServer):
280314 type = click .File (),
281315 help = "The path to trusted TLS CA certificates." ,
282316)
283- @click .option (
284- "--account" ,
285- "-a" ,
286- envvar = "SHINYAPPS_ACCOUNT" ,
287- help = "The shinyapps.io account name." ,
288- )
289- @click .option (
290- "--token" ,
291- "-T" ,
292- envvar = "SHINYAPPS_TOKEN" ,
293- help = "The shinyapps.io token." ,
294- )
295- @click .option (
296- "--secret" ,
297- "-S" ,
298- envvar = "SHINYAPPS_SECRET" ,
299- help = "The shinyapps.io token secret." ,
300- )
317+ @shinyapps_args
301318@click .option ("--verbose" , "-v" , is_flag = True , help = "Print detailed messages." )
302319def add (name , server , api_key , insecure , cacert , account , token , secret , verbose ):
303320
@@ -728,24 +745,7 @@ def deploy_notebook(
728745)
729746@server_args
730747@content_args
731- @click .option (
732- "--account" ,
733- "-a" ,
734- envvar = "SHINYAPPS_ACCOUNT" ,
735- help = "The shinyapps.io account name." ,
736- )
737- @click .option (
738- "--token" ,
739- "-T" ,
740- envvar = "SHINYAPPS_TOKEN" ,
741- help = "The shinyapps.io token." ,
742- )
743- @click .option (
744- "--secret" ,
745- "-S" ,
746- envvar = "SHINYAPPS_SECRET" ,
747- help = "The shinyapps.io token secret." ,
748- )
748+ @shinyapps_args
749749@click .argument ("file" , type = click .Path (exists = True , dir_okay = True , file_okay = True ))
750750@cli_exception_handler
751751def deploy_manifest (
@@ -984,7 +984,9 @@ def deploy_html(
984984 )
985985
986986
987- def generate_deploy_python (app_mode , alias , min_version ):
987+ def generate_deploy_python (app_mode , alias , min_version , supported_by_shinyapps = False ):
988+ shinyapps = shinyapps_args if supported_by_shinyapps else _passthrough
989+
988990 # noinspection SpellCheckingInspection
989991 @deploy .command (
990992 name = alias ,
@@ -998,6 +1000,7 @@ def generate_deploy_python(app_mode, alias, min_version):
9981000 )
9991001 @server_args
10001002 @content_args
1003+ @shinyapps
10011004 @click .option (
10021005 "--entrypoint" ,
10031006 "-e" ,
@@ -1056,6 +1059,9 @@ def deploy_app(
10561059 api_key : str ,
10571060 insecure : bool ,
10581061 cacert : typing .IO ,
1062+ account : str ,
1063+ token : str ,
1064+ secret : str ,
10591065 entrypoint ,
10601066 exclude ,
10611067 new : bool ,
@@ -1110,7 +1116,9 @@ def deploy_app(
11101116deploy_dash_app = generate_deploy_python (app_mode = AppModes .DASH_APP , alias = "dash" , min_version = "1.8.2" )
11111117deploy_streamlit_app = generate_deploy_python (app_mode = AppModes .STREAMLIT_APP , alias = "streamlit" , min_version = "1.8.4" )
11121118deploy_bokeh_app = generate_deploy_python (app_mode = AppModes .BOKEH_APP , alias = "bokeh" , min_version = "1.8.4" )
1113- deploy_shiny = generate_deploy_python (app_mode = AppModes .PYTHON_SHINY , alias = "shiny" , min_version = "2022.07.0" )
1119+ deploy_shiny = generate_deploy_python (
1120+ app_mode = AppModes .PYTHON_SHINY , alias = "shiny" , min_version = "2022.07.0" , supported_by_shinyapps = True
1121+ )
11141122
11151123
11161124@deploy .command (
0 commit comments