Skip to content

Commit

Permalink
py-shiny-files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Shotwell committed Oct 19, 2023
1 parent 59ef96a commit 9405ab8
Show file tree
Hide file tree
Showing 594 changed files with 130,377 additions and 0 deletions.
30 changes: 30 additions & 0 deletions py-shiny/.github/py-shiny/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'setup py-shiny'
description: 'Action that installs python, installs py-shiny dependencies, and installs py-shiny'
inputs:
python-version:
description: 'Python version to use'
required: false
default: "3.11"
runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Upgrade pip
shell: bash
run: python -m pip install --upgrade pip

# TODO-future; Cache pip dependencies; See if installed library can be hashed

- name: Install dependencies
shell: bash
run: |
make install-deps
- name: Install
shell: bash
run: |
make install
46 changes: 46 additions & 0 deletions py-shiny/.github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build API docs

on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.340

- name: Install dependencies
run: |
cd docs
make deps
- name: Run quartodoc
run: |
cd docs
make quartodoc
- name: Build site
run: |
cd docs
make site
135 changes: 135 additions & 0 deletions py-shiny/.github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Run tests

on:
workflow_dispatch:
push:
branches: ["main", "rc-*"]
pull_request:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# "3.10" must be a string; otherwise it is interpreted as 3.1.
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Setup py-shiny
id: install
uses: ./.github/py-shiny/setup
with:
python-version: ${{ matrix.python-version }}

- name: Run unit tests
if: steps.install.outcome == 'success' && (success() || failure())
run: |
make test
- name: Type check with pyright
if: steps.install.outcome == 'success' && (success() || failure())
run: |
make pyright
- name: Lint with flake8
if: steps.install.outcome == 'success' && (success() || failure())
run: |
make lint
- name: black and isort
if: steps.install.outcome == 'success' && (success() || failure())
run: |
make check
e2e:
runs-on: ${{ matrix.os }}
if: github.event_name != 'release'
strategy:
matrix:
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Setup py-shiny
uses: ./.github/py-shiny/setup
with:
python-version: ${{ matrix.python-version }}

- name: Run End-to-End tests
run: |
make e2e
examples:
runs-on: ${{ matrix.os }}
if: github.event_name != 'release'
strategy:
matrix:
python-version: ["3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Setup py-shiny
uses: ./.github/py-shiny/setup
with:
python-version: ${{ matrix.python-version }}

- name: Install node.js
uses: actions/setup-node@v3
with:
node-version: "18"
cache: npm
cache-dependency-path: examples/brownian/shinymediapipe/package-lock.json
- name: Install node.js package
working-directory: examples/brownian/shinymediapipe
run: |
npm ci
- name: Run example app tests
run: |
make e2e-examples
deploy:
name: "Deploy to PyPI"
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: [build]
steps:
- uses: actions/checkout@v3
- name: "Set up Python 3.10"
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make install-deps
make install
- name: "Build Package"
run: |
make dist
# test deploy ----
- name: "Test Deploy to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.event.release.name, 'TEST')
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

## prod deploy ----
- name: "Deploy to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.event.release.name, 'shiny')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
24 changes: 24 additions & 0 deletions py-shiny/.github/workflows/triage-issues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Issue Management

on:
issues:
types: [opened]

jobs:
triage_or_add_to_project:
runs-on: ubuntu-latest

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Check if the issue creator is a maintainer
id: check_maintainer
run: |
IS_ADMIN=`gh api /repos/rstudio/py-shiny/collaborators/${{ github.event.issue.user.login }}/permission --jq='.user.permissions.admin'`
echo "is_maintainer=$IS_ADMIN" >> "$GITHUB_OUTPUT"
- name: Apply "needs triage" label to issues created by non-maintainers
if: steps.check_maintainer.outputs.is_maintainer == 'false'
run: |
gh issue edit ${{ github.event.issue.number }} --add-label "needs-triage" --repo ${{ github.repository }}
44 changes: 44 additions & 0 deletions py-shiny/.github/workflows/verify-js-built.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on:
push:
branches: ["main", "rc-*"]
pull_request:

jobs:
verify_js_built:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Extract node version from .nvmrc
id: nvm
run: echo "::set-output name=version::$(cat .nvmrc)"
working-directory: js

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.version }}"

- name: Install dependencies
run: npm ci
working-directory: js
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Build
run: npm run build
working-directory: js

- name: Check for uncommitted changes
run: |
if [[ `git status --porcelain` ]]; then
git diff
echo "Uncommitted changes found. Please commit any changes that result from 'npm run build'."
exit 1
else
echo "No uncommitted changes found."
fi
working-directory: js
111 changes: 111 additions & 0 deletions py-shiny/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

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

# 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/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

typings/

docs/source/generated/
docs/source/reference/

.DS_Store
.Rproj.user

/.luarc.json
Loading

0 comments on commit 9405ab8

Please sign in to comment.