# Shiny for Python

> Build reactive web apps and dashboards in pure Python

- Category: App UIs & Builders / Data App Builders
- Language: Python
- Licence: MIT
- Repository: https://github.com/posit-dev/py-shiny
- Website: https://shiny.posit.co/py
- Canonical page: https://ai-tldr.dev/tools/shiny-for-python/

## In short

Shiny for Python is a framework from Posit for building interactive web applications in Python. It is the Python port of the R Shiny framework and uses reactive programming, so your UI updates automatically when its underlying inputs and data change. It sits in the Data App Builders category of the App UIs & Builders tools and is open-source, written in Python and licensed MIT.

## Overview

Shiny for Python is a framework from Posit for building interactive web applications in Python. It is the Python port of the R Shiny framework and uses reactive programming, so your UI updates automatically when its underlying inputs and data change. You can stand up a simple interactive visualization or a prototype quickly, then grow the same code into a larger application.

It is aimed at data scientists and Python developers who want to ship dashboards and data tools without writing separate frontend code. Unlike frameworks limited to small scripts, Shiny supports modules so you can structure and scale large, mission-critical apps.

Within the data-app builder category, Shiny sits alongside tools like Dash and Streamlit. Posit positions it around reactive programming and extensibility, with hosting options including Connect Cloud, shinyapps.io, Hugging Face, and the in-browser Shinylive runtime.

## What it does

- Reactive programming model so outputs re-run automatically when inputs change
- A shiny create CLI that scaffolds a new app from a chosen template
- shiny run with --reload and --launch-browser for a live development loop
- Modules for organizing and scaling large applications
- Both Express and Core API styles for writing apps
- Multiple hosting paths: Connect Cloud, shinyapps.io, Hugging Face, and Shinylive (runs in the browser)

## Getting started

Install Shiny from pip, scaffold an app with the CLI, then run it locally with live reload.

1. Install Shiny

   Install the package from PyPI.

```bash
pip install shiny
```

2. Create your first app

   Run shiny create and pick a template when the CLI prompts you. This generates an app.py to start from.

```bash
shiny create
```

3. Run the app

   Launch the app with live reload and open it in your browser. You can also run it from the Shiny editor extension.

```bash
shiny run app.py --reload --launch-browser
```

## When to use it

- Build an interactive dashboard to explore a dataset without writing separate frontend code
- Prototype a data tool in an afternoon and grow it into a production application
- Share a model or analysis as a hosted web app via shinyapps.io, Connect Cloud, or Hugging Face
- Ship a self-contained app that runs entirely in the browser using Shinylive
