Mastering Shiny Examples and Solutions for Python

Author

Youngrok Lee

Published

May 30, 2024

Preface

This material shows how to use Shiny for Python to implement example apps and exerciese solutions for Hadley Wickham’s Mastering Shiny, which were originally implemented in R. My material will contain mostly only codes with few additional specific details of Shiny for Python, while it does not contain comprehensive explanation about Shiny framework. To understand Shiny framework, I highly recommend you to read Hadley Wickham’s Mastering Shiny first, which online version is also available.

The followings are materials that I referenced while creating this material:

Also, I got answers from Shiny community on Discord when I asked questions about implementing several examples. I appreciate great helps from Gordon Shotwell, Joe Cheng, and the community!

Computation environment is as follows:

Python

Python version

!python --version
Python 3.11.9

Packages

with open('requirements.txt', 'r') as f:
    print(f.read())
anyio==4.2.0
appdirs==1.4.4
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asgiref==3.7.2
asttokens==2.4.1
async-lru==2.0.4
atomicwrites==1.4.1
attrs==23.1.0
Babel==2.14.0
beautifulsoup4==4.12.2
bleach==6.1.0
bqplot==0.12.42
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
comm==0.2.0
contourpy==1.2.0
cycler==0.12.1
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==2.0.1
faicons==0.2.1
fastjsonschema==2.19.1
fonttools==4.47.0
fqdn==1.5.1
fuzzywuzzy==0.18.0
gapminder==0.1
gast==0.4.0
h11==0.14.0
haversine==2.8.1
htmltools==0.5.1
idna==3.6
ipydatagrid==1.2.0
ipykernel==6.28.0
ipython==8.18.0
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
jellyfish==0.11.2
Jinja2==3.1.2
joblib==1.3.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.20.0
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.9.0
jupyter-lsp==2.2.1
jupyter_client==8.6.0
jupyter_core==5.5.1
jupyter_server==2.12.1
jupyter_server_terminals==0.5.1
jupyterlab==4.0.10
jupyterlab-widgets==3.0.9
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
kiwisolver==1.4.5
linkify-it-py==2.0.2
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib==3.8.2
matplotlib-inline==0.1.6
mdit-py-plugins==0.4.0
mdurl==0.1.2
mistune==3.0.2
mizani==0.9.3
multipledispatch==1.0.0
natsort==8.4.0
nbclient==0.9.0
nbconvert==7.13.1
nbformat==5.9.2
nest-asyncio==1.5.8
notebook==7.0.6
notebook_shim==0.2.3
numpy==1.26.2
overrides==7.4.0
packaging==23.2
pandas==2.1.4
pandas-flavor==0.6.0
pandocfilters==1.5.0
papermill==2.5.0
parso==0.8.3
pathlib_mate==1.3.2
patsy==0.5.5
pexpect==4.9.0
Pillow==10.1.0
platformdirs==4.1.0
plotnine==0.12.4
prettytable==3.10.0
prometheus-client==0.19.0
prompt-toolkit==3.0.36
psutil==5.9.7
ptyprocess==0.7.0
pure-eval==0.2.2
py2vega==0.6.1
pycparser==2.21
pydataset==0.2.0
Pygments==2.17.2
pyjanitor==0.26.0
pyparsing==3.1.1
python-dateutil==2.8.2
python-json-logger==2.0.7
python-multipart==0.0.6
pytz==2023.3.post1
PyYAML==6.0.1
pyzmq==25.1.2
qgrid==1.3.1
qtconsole==5.5.1
QtPy==2.4.1
questionary==2.0.1
referencing==0.32.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.16.2
scikit-learn==1.3.2
scipy==1.11.4
seaborn==0.13.0
Send2Trash==1.8.2
shiny==0.6.1.1
shiny_validate==0.1
shinyswatch==0.4.2
shinywidgets==0.2.4
six==1.16.0
sniffio==1.3.0
soupsieve==2.5
SQLAlchemy==1.4.52
sqlalchemy-mate==1.4.28.4
stack-data==0.6.3
starlette==0.34.0
statsmodels==0.14.1
tenacity==8.2.3
terminado==0.18.0
threadpoolctl==3.2.0
tinycss2==1.2.1
tornado==6.4
tqdm==4.66.1
traitlets==5.14.0
traittypes==0.2.1
types-python-dateutil==2.8.19.14
typing_extensions==4.9.0
tzdata==2023.4
uc-micro-py==1.0.2
uri-template==1.3.0
urllib3==2.1.0
uvicorn==0.25.0
watchfiles==0.21.0
wcwidth==0.2.12
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
websockets==12.0
widgetsnbextension==4.0.9
xarray==2024.1.1

IDE

VS Code extensions