Advanced Customization and Troubleshooting for Shinylive (Python)

Fine-Tune Your Serverless Shiny Python Apps

Explore advanced customization techniques for Shinylive in Python. Learn how to manage assets, handle multiple Shiny apps, and troubleshoot common issues to ensure your serverless interactive apps run smoothly in the browser.

Tools
Author
Affiliation
Published

March 20, 2025

Keywords

advanced Shinylive Python, Shinylive troubleshooting, customization shinylive

Introduction

As you gain experience with Shinylive for Python, you may want to customize your applications further and ensure they run reliably in production. This tutorial covers advanced topics such as managing web assets, handling multiple Shiny apps within one deployment, and troubleshooting common issues encountered when running Shinylive apps.



1. Asset Management

Efficient asset management is crucial for smooth performance. The shinylive Python package downloads and caches the necessary web assets (HTML, JavaScript, CSS, and WASM) for your app.

Checking Asset Information

Run the following command in your terminal to view asset details:

shinylive extension info

This displays the version of the shinylive package, the asset version, and the cache directory.

Updating and Cleaning Assets

  • Download/Update Assets:
    If you need the latest web assets, update them with:

    shinylive extension language-resources
  • Clean Up Old Assets:
    To free up space and avoid version conflicts, clean up outdated assets:

    shinylive extension clean
Tip

Regularly check and update your assets to maintain compatibility with your app.

2. Handling Multiple Applications

When managing more than one Shiny app, you can export each into separate subdirectories to share common web assets. This approach streamlines maintenance and deployment.

Example: Exporting Multiple Apps

Assume you have two Python Shiny apps in directories myapp1 and myapp2. Export them using:

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

This command creates a site/ folder with subdirectories app1 and app2, each containing its respective static files while sharing common assets.

3. Troubleshooting Common Issues

Even with careful setup, issues may arise. Here are some common troubleshooting steps:

Asset Issues

  • Symptom: The app fails to load or reports missing assets.
  • Solution:
    • Verify asset versions using shinylive extension info.
    • Update assets if necessary using the update commands.
    • Ensure your network or file permissions allow asset downloads.

Export Errors

  • Symptom: The export process fails or produces incomplete output.
  • Solution:
    • Confirm your Shiny for Python app runs correctly in your development environment.
    • Double-check file paths and directory permissions.
    • Run a clean export by removing previous output directories before exporting again.

Deployment Problems

  • Symptom: The app works locally but not when deployed to static hosting (e.g., GitHub Pages).
  • Solution:
    • Ensure that your hosting service is correctly configured to serve static files from your site/ directory.
    • Verify that asset paths remain relative after deployment.
    • Test the deployed site using a local static server (e.g., python3 -m http.server --directory site --bind localhost 8008).

Further Reading

Conclusion

Advanced customization and troubleshooting are essential to ensure your Shinylive Python applications perform reliably in a serverless environment. By managing assets effectively, organizing multiple applications properly, and following best practices, you can optimize your interactive Shiny apps for smooth operation on static hosting platforms.

Back to top

Reuse

Citation

BibTeX citation:
@online{kassambara2025,
  author = {Kassambara, Alboukadel},
  title = {Advanced {Customization} and {Troubleshooting} for
    {Shinylive} {(Python)}},
  date = {2025-03-20},
  url = {https://www.datanovia.com/learn/interactive/python/shinylive/advanced.html},
  langid = {en}
}
For attribution, please cite this work as:
Kassambara, Alboukadel. 2025. “Advanced Customization and Troubleshooting for Shinylive (Python).” March 20, 2025. https://www.datanovia.com/learn/interactive/python/shinylive/advanced.html.