Shiny for Python App-Packages

Getting your Shiny for Python app into a Python package

Author

Martin Frigaard

Published

2026-05-12

Welcome!

CautionAlert

This book walks through how to build Shiny for Python applications inside Python packages. It is a Python companion to Shiny App-Packages, which covers the same workflow for R.

Shiny for Python combines the power of Python’s data science and machine learning capabilities with the interactivity of a web-based application.

Python packages are collections of pre-built, self-contained code, data, and documentation designed to perform operations or accomplish tasks beyond the capabilities of the Python language.

What’s in the book

The book follows a single example application from a bare script through a fully packaged, tested, and deployed Shiny app.

Each part builds on the last:

Part Topic
Introduction Shiny for Python basics and Python package fundamentals
App-Packages Documentation, dependencies, data, and static resources
Debugging Using the Python debugger and logging inside Shiny apps
Testing pytest setup, fixtures, module tests, and end-to-end tests
Deployment Posit Connect, Docker, GitHub Actions, and PyPI
Project Patterns Flat, src/, and monorepo layouts
Tools AI-assisted development and code quality tooling
Special Topics Dynamic UI, app data patterns, Python classes, and reactive design

What’s not in the book

This book isn’t a replacement for the official Shiny for Python documentation. I highly suggest bookmarking this as a resources for up-to-date news and features.

What I assume about you

Readers should be comfortable with basic Python and have some exposure to Shiny for Python. No prior experience with Python packaging is assumed.

Code conventions

All Shiny code uses Shiny Core.1

Code that is meant to be typed in a terminal looks like this:

$ pip install shiny

or2

>>> import numpy as np

Code that belongs in a Python file looks like this:

from shiny import App, ui, render

  1. Read more about the syntax differences here.↩︎

  2. Python code blocks use the jupyter engine.↩︎