Skip to content

Commit

Permalink
update syntax for latest version of shinylive in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Jan 24, 2024
1 parent 102ef03 commit 6cc7c05
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shiny/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,19 @@ def _(func: F) -> F:
# This part is hidden from the typechecker because shinylive is not a direct
# dependency of shiny and we only need this section when building the docs.
try:
import shinylive
from shinylive import ShinyliveApp
except ImportError:
raise RuntimeError(
"Please install the latest version of shinylive to build the docs."
)
except ModuleNotFoundError:
raise RuntimeError("Please install shinylive to build the docs.")

class ShinyliveExampleWriter(ExampleWriter):
def write_example(self, app_files: list[str]) -> str:
app_file = app_files.pop(0)
app = shinylive.url_encode(app_file, app_files, language="py")
app = ShinyliveApp.from_local(app_file, app_files, language="py")

return app.chunk(layout="vertical", viewerHeight=400)
return app.chunk(layout="vertical", viewer_height=400)

example_writer = ShinyliveExampleWriter()

0 comments on commit 6cc7c05

Please sign in to comment.