- Interactive app: cintel-02-app
- Repository: cintel-02-app
- Author: Denise Case
Purpose: Create an interactive analytics dashboard using Shiny for Python.
- Join GitHub
- Install Git
- Configure Git with user.name and user.email
- Install current Python. Important: Add Python to PATH during installation
- Install VS Code Editor
- Install VS Code Extension: Python
- Install VS Code Extension: Shiny
Add the following extension now - or just add the json file later and VS Code will prompt you to install.
- Install VS Code Extension: Pyright
- Sign up for a free account on shinyapps.io. You can sign in via GitHub for convenience.
- Open browser and log in to GitHub
- Create a new repo (e.g. cintel-02-app) with Default README.md and .gitignore (for Python).
- Open VS Code.
- Clone GitHub repo into Documents folder.
Open your project folder in VS Code. Open a VS Code terminal (PowerShell or Bash or zsh) using Terminal / New Terminal.
- Add file: pyrightconfig.json (see example in this repo).
- Upgrade pip and install wheel.
- Create local project virtual environment (just once at the beginning)
- Activate the local project virtual environment (whenever you open a new terminal).
- Install packages into active environment (once at the start and whenever you add new packages).
- Freeze to requirements.txt (after adding or upgrading packages - see example in this repo).
- Document your workflow and commands in your README.md.
Example Terminal Commands for Windows - record your process in your README.md:
py -m pip install --upgrade pip wheel
py -m venv .venv
.\.venv\Scripts\Activate.ps1
py -m pip install --upgrade -r requirements.txt
Example Terminal Commands for Mac/Linux - record your process in your README.nd:
python3 -m pip install --upgrade pip wheel
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade -r requirements.txt
- In VS Code with your project folder open, create a new file app.py in the root project folder.
- See the example in this repo.
In the terminal window, run the app with the following command. Note that the terminal will be busy running the app. If you need to run any additional terminal commands, you'll have to open a new terminal window.
Choose one of the following commands. The first command will not open a browser window. The second command will open a browser window and continuously refresh based on changes to the app.py file.
shiny run app.py
shiny run --reload --launch-browser ./app.py
You should see the following output:
INFO: Started server process [8112]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Open your browser and go to http://127.0.0.1:8000