Skip to contents

Converts a Python Shiny application directory into a shinylive application that can run entirely in the browser using Pyodide.

Usage

convert_py_to_shinylive(
  appdir,
  output_dir,
  subdir = NULL,
  overwrite = FALSE,
  verbose = TRUE
)

Arguments

appdir

Character string. Path to the directory containing the Python Shiny application.

output_dir

Character string. Path where the converted shinylive app will be saved.

subdir

Character or NULL. When set, the app is exported into a <subdir> subdirectory of output_dir as an additive shared-site export, preserving existing contents (including a shared shinylive/ asset tree). When NULL (default), a single-app export is performed and an existing output_dir is removed when overwrite = TRUE.

overwrite

Logical. Whether to overwrite existing output directory. Default is FALSE.

verbose

Logical. Whether to display detailed progress information. Default is TRUE.

Value

Character string. Path to the converted shinylive application directory.

Details

This function converts a Python Shiny application to shinylive format using the Python shinylive package. The application will run entirely in the browser using Pyodide (Python compiled to WebAssembly).

Requirements:

  • Python 3 must be available on the build machine

  • The Python shinylive package must be installed (pip install shinylive)

  • The app directory must contain an app.py file

Examples

if (FALSE) { # \dontrun{
convert_py_to_shinylive(
  appdir = "path/to/python/shiny/app",
  output_dir = "path/to/shinylive/output"
)
} # }