Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
denisecase committed May 29, 2023
0 parents commit fd47afd
Show file tree
Hide file tree
Showing 26 changed files with 1,762 additions and 0 deletions.
167 changes: 167 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# This file lists the files and folders that should NOT be committed to GitHub.

# Virtual environment
.venv/
venv/


# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Continuous Intelligence and Interactive Analytics - Initial App

- Repository: [cintel-04-reactive](https://github.com/denisecase/cintel-04-reactive)
- Website: [cintel-04-reactive](https://denisecase.github.io/cintel-04-reactive/)
- Author: [Denise Case](https://github.com/denisecase)


Note: 🚀 Rocket Tips are for learners who want to go beyond the basics.
They are NOT required but can improve our workflow, increase productivity, and make things more enjoyable.
-----


## Prerequisites

You'll need the tools installed in

- [cintel-01-getting-started](https://github.com/denisecase/cintel-01-getting-started)
- [cintel-02-app](https://github.com/denisecase/cintel-02-app)
- [cintel-03-data](https://github.com/denisecase/cintel-03-data)

## Sign Up for shinyapps.io (Free Account)

Sign up for a free account on shinyapps.io.
I sign in via GitHub for convenience.

## Copy This Repository

Copy this starter repository into your own GitHub account by clicking the 'Fork' button at the top of this page.

-----

## Customize Your Web App

### Get the Code to your Local Machine

1. Open VS Code and from the menu, select **View** / **Command Palette**.
1. Type "Git: Clone" in the command palette and select it.
1. Enter the URL (web address) of your forked GitHub repository (make sure it contains your GitHub username - not denisecase).
1. Choose a directory on your local machine (e.g., Documents folder) to store the project.
1. If prompted, sign in to GitHub from VS Code.

### Make Changes in VS Code

With your respository folder open in VS Code:

1. Click on this README.md file for editing.
1. Update the README.md file by changing your name in the author link above.
1. Update the links in the README.md file to your username instead of denisecase.

### Save Your Changes

1. After making changes, you want to send them back to GitHub.
1. In VS Code, find the "Source Control" icon and click it.
1. Important: Enter a brief commit message describing your changes.
1. Change the "Commit" button dropdown to "Commit and Push" to send your changes back to GitHub.

-----

## Reminders

Details matter - check spelling, capitalization, plurals, spacing when things don't match.

## Resources

- [Seaborn](https://seaborn.pydata.org/)
- [Plotly](https://plotly.com/python/)
- [Bokeh](https://docs.bokeh.org/en/latest/index.html)


- [Seaborn Flights Dataset](https://seaborn.pydata.org/tutorial/data_structure.html)
34 changes: 34 additions & 0 deletions REQUIREMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Python Libraries for Interactive Analytics

This collection includes various Python packages that are used for interactive analytics. Each tool serves a unique purpose and is suitable for different use cases.
Use your favorites. Try new ones. Share your experiences with the community.

Data Manipulation:
- **pandas**: A powerful data manipulation library that provides flexible data structures and functions to manipulate structured data. [pandas documentation](https://pandas.pydata.org/)

Excel Library:
- **openpyxl**: A Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files. [openpyxl documentation](https://openpyxl.readthedocs.io/en/stable/)

Template Engine:
- **jinja2**: A modern and designer-friendly templating language for Python. It is often used to create HTML, XML or other markup formats that are returned to the user via an HTTP request. [jinja2 documentation](https://jinja.palletsprojects.com/)

Data Visualization:
- **matplotlib**: A data visualization library that provides a MATLAB-like interface for creating plots and charts. [matplotlib dataset list](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.html#module-matplotlib.pyplot)
- **seaborn**: A data visualization library built on top of matplotlib, providing datasets and high-level statistical graphics. [seaborn dataset list](https://github.com/mwaskom/seaborn-data)
- **plotnine**: A Python implementation of the R package ggplot2, which is a "grammar of graphics" implementation. It allows you to create complex plots with a few lines of code. [plotnine documentation](https://plotnine.readthedocs.io/en/stable/)
- **plotly**: A Python graphing library that makes interactive, publication-quality graphs online. It provides a wide range of visualization types and features. [plotly documentation](https://plotly.com/python/)
- **holoviews**: A Python library that makes data visualization as simple as possible, by automatically connecting data and its graphical representation. [holoviews documentation](http://holoviews.org/)
- **hvplot**: A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews. [hvplot documentation](https://hvplot.holoviz.org/)

Interactive Maps:
- **ipyleaflet**: A Python library for creating interactive maps. It is a Jupyter notebook widget that uses leaflet.js for rendering maps. [ipyleaflet documentation](https://ipyleaflet.readthedocs.io/en/latest/)

Web-based Visualization:
- **bokeh**: A Python library for creating interactive visualizations and plots, emphasizing web-based, modern, and high-performance output. [bokeh documentation](https://docs.bokeh.org/en/latest/index.html)
- **jupyter_bokeh**: A Jupyter extension for rendering bokeh content in Jupyter notebook cells. [jupyter_bokeh documentation](https://github.com/bokeh/jupyter_bokeh)

Web Applications:
- **shiny**: A package in R (with a Python version also available) for creating interactive web applications straight from R and Python. [shiny documentation](https://shiny.rstudio.com/)
- **shinyswatch**: A package that provides additional themes for Shiny applications. [shinyswatch documentation](https://github.com/Appsilon/shinyswatch)
- **shinywidgets**: Enhance your Shiny apps with advanced widgets like sliders, checkboxes, etc. [shinywidgets documentation](https://github.com/Appsilon/shiny.widgets)
- **panel**: A high-level app anddashboarding solution for Python that works well with the PyData ecosystem. It allows you to create interactive dashboards and applications with ease. [panel documentation](https://panel.holoviz.org/)
92 changes: 92 additions & 0 deletions SHINY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Interactive Analytics with Shiny

Earlier, you installed Python and verified it with:

```shell
python --version
python3 --version
py --version
```

Use the command that works instead of `python` in the following instructions.
You're encouraged to modify these Markdown (.md) files to reflect the commands that work on your machine.

## Install and Upgrade Python Tools Globally

Install some additional content into your global Python for best results.
open your terminal (PowerShell on Windows, Terminal on Mac/Linux) and
install these to your default Python using the commands below.


```shell
python -m pip install --upgrade pip wheel
python -m pip install --upgrade black ruff pyright
python -m pip install --upgrade rsconnect-python
```

You must have reconnect-python installed for the next step.

## Authorize shinyapps.io

Using Chrome (recommended), sign in to your free shinyapps.io account (I use GitHub to sign in.)

1. On the Getting Started page, click on the "Start with Python" tab.
1. Click "Show Secret"
1. Click "Copy to Clipboard". Follow the instructions. Mine said
1. Hit Ctrl c / ENTER to copy the provided command to the clipboard.
1. Open a terminal window. (Terminal on Mac/Linux, PowerShell on Windows).
1. Click in the terminal window to paste the command and hit ENTER to run it.

![Get the Command to Authorize shinyapps.io](images/GetCommandToAuthorizeShinyAppsdotIO.PNG)

## Create a Virtual Environment

```shell
python -m venv .venv
```

When VS Code asks if it should add the new virtual environment, click yes.


## Activate the Virtual Environment

- Activate it on Windows: `.venv\Scripts\activate`
- Activate it on macOS/Linux `source .venv/bin/`

## Install Libaries into Virtual Environment

This gives a good selection of options. You only need to install the ones you use.

```shell
python -m pip install --upgrade pip wheel shiny shinyswatch
python -m pip install --upgrade pandas openpyxl jinja2 matplotlib seaborn plotnine
python -m pip install --upgrade shinywidgets plotly holoviews panel hvplot ipyleaflet
python -m pip install --upgrade jupyter_bokeh

```

OR List your requirements in requirements.txt and install them all at once.

```shell
python -m pip install --upgrade -r requirements.txt
```


## Run the App

Verify your virtual environment is activated. Run the app.

```shell
shiny run --reload app.py
```

Open the app by following the instructions provided in the terminal.
For example, try CRTL CLICK (at the same time) on the URL displayed (http://127.0.0.1:8000).

Hit CTRL c (at the same time) to quit the app.
If it won't stop, close the terminal window.
Reopen the terminal window and be sure the virtual environment is activated
before running the app again.



Loading

0 comments on commit fd47afd

Please sign in to comment.