Skip to main content

Run Shiny applications running Python in the browser.

Project description

Shinylive Python package

Build and test PyPI Latest Release

Documentation site

The goal of the shinylive Python package is to help you create Shinylive applications from your Shiny for Python applications. Shinylive runs Shiny entirely in the browser, without any need for a hosted server, using WebAssembly via pyodide.

About Shinylive

The Shinylive project consists of four interdependent components that work together in several different contexts.

  1. Shinylive (posit-dev/shinylive) is a web assets library that runs Shiny applications in the browser. You can try it out online at shinylive.io/r or shinylive.io/py.

  2. The shinylive Python package (posit-dev/py-shinylive) helps you export your Shiny applications from local files to a directory that can be hosted on a static web server.

    The Python package also downloads the Shinylive web assets mentioned above and manages them in a local cache. These assets are included in the exported Shinylive applications and are used to run your Shiny app in the browser.

  3. The shinylive R package (posit-dev/r-shinylive) serves the same role as the shinylive Python package but for Shiny for R apps.

  4. The shinylive Quarto extension (quarto-ext/shinylive) lets you write Shiny applications in Quarto web documents and slides and uses the Python or R package (or both) to translate shinylive-py or shinylive-r code blocks into Shinylive applications.

Installation

pip install shinylive

Usage

(Optional) Create a basic shiny application in a new directory myapp/:

shiny create myapp

Once you have a Shiny application in myapp/ and would like turn it into a Shinylive app in site/:

shinylive export myapp site

Then you can preview the application by running a web server and visiting it in a browser:

python3 -m http.server --directory site --bind localhost 8008

At this point, you can deploy the site/ directory to any static web hosting service.

Multiple applications

If you have multiple applications that you want to put on the same site, you can export them to subdirectories of the site, so that they can all share the same Shinylive assets. You can do this with the --subdir option:

shinylive export myapp1 site --subdir app1
shinylive export myapp2 site --subdir app2

Shinylive asset management

Each version of the Shinylive Python package is associated with a particular version of the Shinylive web assets. (See the releases here.)

To see which version of this Python package you have, and which version of the web assets it is associated with, simply run shinylive at the command prompt:

$ shinylive
Usage: shinylive [OPTIONS] COMMAND [ARGS]...

  shinylive Python package version: 0.1.0
  shinylive web assets version:     0.2.1
...

The web assets will be downloaded and cached the first time you run shinylive export. Or, you can run shinylive assets download to fetch them.

$ shinylive assets download
Downloading https://github.com/posit-dev/shinylive/releases/download/v0.2.1/shinylive-0.2.1.tar.gz...
Unzipping to /Users/username/Library/Caches/shinylive/

To see what versions you have installed, run shinylive assets info:

$ shinylive assets info
    Local cached shinylive asset dir:
    /Users/username/Library/Caches/shinylive

    Installed versions:
    /Users/username/Library/Caches/shinylive/shinylive-0.2.1
    /Users/username/Library/Caches/shinylive/shinylive-0.0.6

You can remove old versions with shinylive assets cleanup. This will remove all versions except the one that the Python package wants to use:

$ shinylive assets cleanup
Keeping version 0.2.1
Removing /Users/username/Library/Caches/shinylive/shinylive-0.0.6

If you want to force it to remove a specific version, use the shinylive assets remove xxx:

$ shinylive assets remove 0.2.1
Removing /Users/username/Library/Caches/shinylive/shinylive-0.2.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shinylive-0.7.1.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

shinylive-0.7.1-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file shinylive-0.7.1.tar.gz.

File metadata

  • Download URL: shinylive-0.7.1.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for shinylive-0.7.1.tar.gz
Algorithm Hash digest
SHA256 ddd0c1ce0951955e1e06d5ce24a242de0f73a4e8b73d9faf64e66c6ab00b947e
MD5 bc3d4e3f896daf5fa83d8b68b19a83fc
BLAKE2b-256 18ee7f6dde4b15ff6723b1196b9469bbee5ebf37f465f5e1a6b6b3d191997f36

See more details on using hashes here.

File details

Details for the file shinylive-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: shinylive-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for shinylive-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f44b3c555196c59f6d56a7f23c8f4912ddf0d9d05239b1f42d442af05fbc7f65
MD5 c5e841026ba97ae84b2f7ec679d42975
BLAKE2b-256 fb5bbed5c014036ab8388f305f8132a582cfdea091ae0eeb49df96f97f952a85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page