Introduction
Shinylive for Python enables you to run Shiny applications written in Python entirely in the browser—without a dedicated server—by leveraging WebAssembly. This tutorial will guide you through installing the shinylive Python package and configuring asset management, so you can easily convert your Shiny for Python apps into static, serverless web applications.
1. Installing the shinylive Python Package
There are two main ways to install the shinylive Python package:
Option 1: Install from PyPI
The easiest method is to install the package from PyPI using pip. Open your terminal or command prompt and run:
pip install shinylive --upgrade
This command installs the latest stable release of shinylive.
Option 2: Install from GitHub
If you need the development version or the latest features, you can install shinylive directly from GitHub:
pip install git+https://github.com/posit-dev/py-shinylive.git
Choose the option that best suits your needs.
2. Configuring Asset Management
Shinylive automatically downloads the web assets (HTML, JavaScript, CSS, and WASM files) required to run your Shiny for Python apps in the browser. These assets are cached locally to speed up subsequent loads.
Checking Asset Information
To verify that the assets are correctly installed, run the following command in your terminal:
shinylive extension info
This command will display the version of the shinylive package, the version of the web assets, and their cache paths.
Updating and Cleaning Assets
Download/Update Assets:
If you need to update to a specific asset version, you can use the CLI to download it. For example, consult the documentation using:shinylive extension language-resources
Cleaning Up Old Assets:
Periodically, you may want to clean up outdated assets. Refer to the package documentation for cleanup commands.
3. Verifying Your Setup
After installation, confirm that everything is set up properly by running:
shinylive --help
This command shows you a list of available commands and options, confirming that shinylive is ready to use.
Further Reading
- Introduction to Shinylive for Python
Get an overview of Shinylive for Python, its components, and its benefits for serverless Shiny applications. - Creating a Basic Shinylive Python Application
Learn how to build and export your first Shinylive Python app. - Embedding Shinylive Python Apps in Quarto Documents
Discover how to integrate Shinylive apps directly into your Quarto blog posts or articles.
Conclusion
With the shinylive Python package installed and asset management configured, you’re ready to convert your Shiny for Python apps into interactive, serverless web applications. Follow the further reading links for more detailed tutorials on creating and embedding Shinylive apps, and enjoy the power of running Shiny apps directly in your browser!
References
Explore More Articles
Here are more articles from the same category to help you dive deeper into the topic.
Reuse
Citation
@online{kassambara2025,
author = {Kassambara, Alboukadel},
title = {Installing and {Setting} {Up} {Shinylive} for {Python}},
date = {2025-03-20},
url = {https://www.datanovia.com/learn/interactive/python/shinylive/installation.html},
langid = {en}
}