Skip to main content

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

GitHub Pages

posit-dev/py-shinylive has a workflow to automatically deploy the Shiny app in the root directory of your GitHub repository to its GitHub Pages. Add it to your repo with:

mkdir -p .github/workflows
curl -fsSL https://raw.githubusercontent.com/posit-dev/py-shinylive/actions/v1/examples/deploy-app.yaml \
  -o .github/workflows/deploy-app.yaml

Then, in your repository's Settings > Pages, set the "Source" to "GitHub Actions".

For more information, see the examples folder.

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

Metadata

Release files for shinylive 0.8.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shinylive 0.8.13
File Size Uploaded Provenance Actions
shinylive-0.8.13.tar.gz 30.0 kB Without provenance Details for shinylive-0.8.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shinylive 0.8.13
File Interpreter ABI Platform Actions
shinylive-0.8.13-py3-none-any.whl Python 3 none any Details for shinylive-0.8.13-py3-none-any.whl

Total release size: 59.7 kB

Release files / shinylive-0.8.13.tar.gz

Download URL shinylive-0.8.13.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cdde0c38df1dc2a9e93a11161935ef3d39ced583cf8fdbee717065fac07bfd1d
BLAKE2b-256 checksum
How to use checksums
64178790d5bad21f1770454f5c0a6b7899e5285b47e0be265798cb053aea80d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / shinylive-0.8.13-py3-none-any.whl

Download URL shinylive-0.8.13-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bb49b5a469937c62d7d491eb2d240f1f460ad60fe8b1f1eaafcf85212084461
BLAKE2b-256 checksum
How to use checksums
2517c9959025ceb02f36ed02b28cedc1a2a670596bb985fe2451e819e6a883e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for shinylive 0.8.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.13 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page