Shiny makes it easy to build interactive web applications with the power of Python’s data and scientific stack.
Approachable: Write your application in Python; no web development skills required. Flexible: Built from the ground up to support custom layouts, styles, and the modularity required for full-fledged applications, all from Python. Performance: Uses creativity to efficiently handle data processing and minimize expensive re-computations.
Before you go any further, Make sure you already installed Python and that the expected version is available from your command line. You can check this by running:
python3 --version or python --version
The result will be like this
py --version
# Create a virtual environment in the .venv subdirectory
python3 -m venv venv
# Activate the virtual environment
source venv/bin/activateshinylibrary.Open terminal type pip install shiny and
pip install --upgrade shiny htmltools. You can use
pip list to list all of library you installed with
pip.
You may on occasion need to force installation of updated versions of
our packages, since they are in development
pip install --upgrade shiny htmltools
# Create a conda environment named 'myenv'
conda create --name myenv
# Activate the virtual environment
conda activate myenvshinylibrary.
conda install -c conda-forge shiny
and conda update -c conda-forge shinyAfter you install vscode, open it, go to Extension the
red square, type shiny, then install
Shiny for Python
# Open terminal type
mkdir myshinyapp_python
cd myshinyapp_pythonWe are in directory myshinyapp_python, I create a shiny
app name first_python_app
shiny create first_python_appNow you can go to the
myshinyapp_python/first_python_app, you will see the file
name app.py
app.py on vscode or
browserGo to file and open the app.py
Click the Run button (square in yellow in the screenshot below) becomes “Run Shiny App”.
# Open terminal
shiny run --reload first_python_app/app.py
Enter http://127.0.0.1:8000 on browser
rsconnect-pythonpip install rsconnect-pythonrsconnect write-manifest shiny first_python_app
You will see 3 files in your directory
first_python_app
first_python_app/
app.py
manifest.json
requirements.txttoken from shinyapps.io
Copy the codes in purple box in your terminal
rsconnect-python# guide to deploy app
rsconnect deploy shiny --helpfirst_python_app with a title
first_python_app_test# deploy the app
rsconnect deploy shiny first_python_app --name loanrobinsonscientist --title first_python_app_test