File tree Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ doc =
102
102
jupyter
103
103
jupyter_client < 8.0.0
104
104
tabulate
105
- shinylive @ git+https://github.com/posit-dev/py-shinylive.git@main
105
+ shinylive @ git+https://github.com/posit-dev/py-shinylive.git
106
106
pydantic ==1.10
107
107
quartodoc ==0.7.2
108
108
griffe ==0.33.0
Original file line number Diff line number Diff line change @@ -177,29 +177,19 @@ def _(func: F) -> F:
177
177
# This part is hidden from the typechecker because shinylive is not a direct
178
178
# dependency of shiny and we only need this section when building the docs.
179
179
try :
180
- import shinylive
180
+ from shinylive import ShinyliveApp
181
+ except ImportError :
182
+ raise RuntimeError (
183
+ "Please install the latest version of shinylive to build the docs."
184
+ )
181
185
except ModuleNotFoundError :
182
186
raise RuntimeError ("Please install shinylive to build the docs." )
183
187
184
- SHINYLIVE_CODE_TEMPLATE = """
185
- ```{{shinylive-python}}
186
- #| standalone: true
187
- #| components: [editor, viewer]
188
- #| layout: vertical
189
- #| viewerHeight: 400
190
-
191
- {0}
192
- ```
193
- """
194
-
195
188
class ShinyliveExampleWriter (ExampleWriter ):
196
189
def write_example (self , app_files : list [str ]) -> str :
197
190
app_file = app_files .pop (0 )
198
- bundle = shinylive ._url .create_shinylive_bundle_file (
199
- app_file , app_files , language = "py"
200
- )
201
- code = shinylive ._url .create_shinylive_chunk_contents (bundle )
191
+ app = ShinyliveApp .from_local (app_file , app_files , language = "py" )
202
192
203
- return SHINYLIVE_CODE_TEMPLATE . format ( code . strip () )
193
+ return app . to_chunk ( layout = "vertical" , viewer_height = 400 )
204
194
205
195
example_writer = ShinyliveExampleWriter ()
You can’t perform that action at this time.
0 commit comments