Skip to content

Commit

Permalink
Merge branch 'main' into drop_fn_session_param
Browse files Browse the repository at this point in the history
* main: (76 commits)
  Add shiny/templates to MANIFEST.in files (#926)
  docs: Function Reference Proofreads (#919)
  Fix failing deploy tests (#925)
  Add GitHub sources to shiny create
  Make changelog styling more consistent
  Function reference edits (#857)
  docs: Use definition lists for parameter descriptions to enable full markdown support (#901)
  docs(layout_columns): Add example app (#903)
  fix(layout_columns): Remove use of enum for breakpoints (#912)
  Express: don't automatically put strings in a `<pre>` block (#905)
  Deprecate `nav()` in favor of `nav_panel()` (#876)
  chore: Remove unused import
  refactor(layout_column_wrap): Use helper for wrapping children (#910)
  fix(layout_columns): Don't apply fillable class to layout container (#909)
  Add output to React template (#908)
  fix(layout_columns): Add missing `bslib-mb-spacing` class (#906)
  Custom component template updates (#874)
  fix(layout_columns): If the breakpoint name is an enum, need to collect the value (#902)
  chore: exclude `_dev/` folder (#897)
  feat: Add `ui.layout_columns()` (#856)
  ...
  • Loading branch information
schloerke committed Dec 19, 2023
2 parents 772b114 + c19bf27 commit 65829a3
Show file tree
Hide file tree
Showing 312 changed files with 10,354 additions and 1,406 deletions.
1 change: 1 addition & 0 deletions .github/py-shiny/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ runs:
- name: Install dependencies
shell: bash
run: |
pip install https://github.com/rstudio/py-htmltools/tarball/main
make install-deps
- name: Install
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- name: Install dependencies
run: |
cd docs
make ../venv
. ../venv/bin/activate && pip install https://github.com/rstudio/py-htmltools/tarball/main
make deps
- name: Run quartodoc
Expand All @@ -44,3 +46,31 @@ jobs:
run: |
cd docs
make site
- name: Upload site artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with:
path: "docs/_site"


deploy:
if: github.ref == 'refs/heads/main'
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
77 changes: 69 additions & 8 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
release:
types: [published]
schedule:
- cron: "0 8 * * *"

jobs:
build:
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:
run: |
make check
e2e:
playwright-shiny:
runs-on: ${{ matrix.os }}
if: github.event_name != 'release'
strategy:
Expand All @@ -63,10 +65,11 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Run End-to-End tests
timeout-minutes: 20
run: |
make e2e
make playwright-shiny
e2e-examples:
playwright-examples:
runs-on: ${{ matrix.os }}
if: github.event_name != 'release'
strategy:
Expand Down Expand Up @@ -94,12 +97,13 @@ jobs:
npm ci
- name: Run example app tests
timeout-minutes: 20
run: |
make e2e-examples
make playwright-examples
e2e-deploys:
# Only allow one `e2e-deploys` job to run at a time. (Independent of branch / PR)
concurrency: e2e-deploys
playwright-deploys:
# Only allow one `playwright-deploys` job to run at a time. (Independent of branch / PR)
concurrency: playwright-deploys
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'deploy')) }}
strategy:
Expand All @@ -122,8 +126,10 @@ jobs:
DEPLOY_SHINYAPPS_NAME: "${{ secrets.DEPLOY_SHINYAPPS_NAME }}"
DEPLOY_SHINYAPPS_TOKEN: "${{ secrets.DEPLOY_SHINYAPPS_TOKEN }}"
DEPLOY_SHINYAPPS_SECRET: "${{ secrets.DEPLOY_SHINYAPPS_SECRET }}"
timeout-minutes: 30
run: |
make e2e-deploys
make playwright-deploys
pypi:
name: "Deploy to PyPI"
runs-on: ubuntu-latest
Expand All @@ -138,6 +144,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install https://github.com/rstudio/py-htmltools/tarball/main
make install-deps
make install
- name: "Build Package"
Expand All @@ -160,3 +167,57 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

testrail-reporting-nightly:
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'schedule' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'testrail')) }}
strategy:
matrix:
python-version:
- "3.11"
- "3.10"
- "3.9"
# - "3.8" # Testrail has errors when running on python 3.8; Skipping
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 End-to-End tests
timeout-minutes: 20
run: |
make testrail-junit
- name: Report results to Testrail
env:
TESTRAIL_URL: "https://posit.testrail.io"
TESTRAIL_PROJECT: "Shiny-Python"
TESTRAIL_USER: "${{ secrets.TESTRAIL_USER }}"
TESTRAIL_PASSWORD: "${{ secrets.TESTRAIL_PASSWORD }}"
run: |
CURRENT_DATE="$(date +'%Y-%m-%d %H:%M:%S') Nightly tests"
trcli \
--yes \
--host "$TESTRAIL_URL" \
--project "$TESTRAIL_PROJECT" \
--username "$TESTRAIL_USER" \
--password "$TESTRAIL_PASSWORD" \
parse_junit \
--file "report.xml" \
--title "$CURRENT_DATE" \
--close-run
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__/
*.py[cod]
*$py.class

Expand Down Expand Up @@ -110,3 +110,6 @@ docs/source/reference/
.Rproj.user

/.luarc.json

# Developer scratch area
_dev/
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"editor.tabSize": 2,
"files.encoding": "utf8",
"files.eol": "\n",
Expand All @@ -27,10 +25,11 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
}
},
"isort.args": ["--profile", "black"],
Expand All @@ -42,5 +41,5 @@
"autoDocstring.guessTypes": false,
"search.exclude": {
"build/**": true
}
},
}
52 changes: 36 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

### New features

* `shiny create` now allows you to select from a list of template apps.
* `shiny create` provides templates which help you build your own custom JavaScript components.
* Closed #814: The functions `reactive.Calc` and `reactive.Effect` have been changed to have lowercase names: `reactive.calc`, and `reactive.effect`. The old capitalized names are now aliases to the new lowercase names, so existing code will continue to work. Similarly, the class `reactive.Value` has a new alias, `reactive.value`, but in this case, since the original was a class, it keeps the original capitalized name as the primary name. The examples have not been changed yet, but will be changed in a future release. (#822)
* Added `ui.layout_columns()` for creating responsive column-forward layouts based on Bootstrap's 12-column CSS Grid. (#856)

### Bug fixes

* Fix support for `shiny.ui.accordion(multiple=)` (#799).

### Other changes

* Closed #492: `shiny.ui.nav()` is now deprecated in favor of the more aptly named `shiny.ui.nav_panel()` (#876).
* Update penguins example to credit Allison Horst and drop usage of `shiny.experimental` (#798).
* `as_fillable_container()` and `as_fill_item()` no longer mutate the `Tag` object that was passed in. Instead, it returns a new `Tag` object. Also closed #856: these functions now put the `html-fill-container` and `html-fill-item` CSS classes last, instead of first. (#862)


## [0.6.0] - 2023-10-30

### Breaking Changes
* `shiny.run` only allows positional arguments for `app`, `host`, and `port`, all other arguments must be specified with keywords.

Expand All @@ -30,6 +50,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Added `shiny.ui.showcase_bottom()`, a new `shiny.ui.value_box()` layout that places the showcase below the value box `title` and `value`, perfect for a full-bleed plot. (#772)

### Bug fixes

* `shiny run` now respects the user provided `reload-dir` argument (#765).
* Fixed #646: Wrap bare value box value in `<p />` tags. (#668)
* Fixed #676: The `render.data_frame` selection feature was underdocumented and buggy (sometimes returning `None` as a row identifier if the pandas data frame's index had gaps in it). With this release, the selection is consistently a tuple of the 0-based row numbers of the selected rows--or `None` if no rows are selected. (#677)
* Added tests to verify that ui input methods, ui labels, ui update (value) methods, and ui output methods work within modules (#696).
* Adjusted the `@render.plot` input type to be `object` to allow for any object (if any) to be returned (#712).
* In `layout_column_wrap()`, when `width` is a CSS unit -- e.g. `width = "400px"` or `width = "25%"` -- and `fixed_width = FALSE`, `layout_column_wrap()` will ensure that the columns are at least `width` wide, unless the parent container is narrower than `width`. (#772)

### Other changes

* `input_action_button()` now defaults to having whitespace around it. (#758)
* `layout_sidebar()` now uses an `<aside>` element for the sidebar's container and a `<header>` element for the sidebar title. The classes of each element remain the same, but the semantic meaning of the elements is now better reflected in the HTML markup. (#772)
* `layout_sidebar()` no longer gives the sidebar main content area the `role="main"` attribute. (#772)
* Improved the style and appearance of the button to enter full screen in `card()`s and `value_box()`es to better adapt to Bootstrap's dark mode. (#772)

### API changes

* Added `shiny.ui.navset_underline()` and `shiny.ui.navset_card_underline()` whose navigation container is similar to `shiny.ui.navset_tab()` and `shiny.ui.navset_card_tab()` respectively, but its active/focused navigation links are styled with an underline. (#772)
Expand Down Expand Up @@ -88,22 +124,6 @@ Methods still under consideration in `shiny.experimental.ui`:
* Support for `min_height=`, `max_height=`, and `gap=` in `shiny.experimental.ui.as_fillable_container()` and `as_fill_item()` has been removed. (#481)
* `shiny.experimental.ui.TagCallable` has been made defunct. Please use its type is equivalent to `htmltools.TagFunction`. (#680)

### Bug fixes

* `shiny run` now respects the user provided `reload-dir` argument (#765).
* Fixed #646: Wrap bare value box value in `<p />` tags. (#668)
* Fixed #676: The `render.data_frame` selection feature was underdocumented and buggy (sometimes returning `None` as a row identifier if the pandas data frame's index had gaps in it). With this release, the selection is consistently a tuple of the 0-based row numbers of the selected rows--or `None` if no rows are selected. (#677)
* Added tests to verify that ui input methods, ui labels, ui update (value) methods, and ui output methods work within modules (#696).
* Adjusted the `@render.plot` input type to be `object` to allow for any object (if any) to be returned (#712).
* In `layout_column_wrap()`, when `width` is a CSS unit -- e.g. `width = "400px"` or `width = "25%"` -- and `fixed_width = FALSE`, `layout_column_wrap()` will ensure that the columns are at least `width` wide, unless the parent container is narrower than `width`. (#772)

### Other changes

* `input_action_button()` now defaults to having whitespace around it. (#758)
* `layout_sidebar()` now uses an `<aside>` element for the sidebar's container and a `<header>` element for the sidebar title. The classes of each element remain the same, but the semantic meaning of the elements is now better reflected in the HTML markup. (#772)
* `layout_sidebar()` no longer gives the sidebar main content area the `role="main"` attribute. (#772)
* Improved the style and appearance of the button to enter full screen in `card()`s and `value_box()`es to better adapt to Bootstrap's dark mode. (#772)


## [0.5.1] - 2023-08-08

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
recursive-include shiny/www *
recursive-include shiny/experimental/www *
recursive-include shiny/api-examples *
recursive-include shiny/ui/dataframe/js/dist *
recursive-include shiny/templates *
33 changes: 21 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help clean clean-test clean-pyc clean-build help lint test e2e e2e-examples
.PHONY: help clean clean-test clean-pyc clean-build help lint test playwright-shiny playwright-examples playwright-deploys install-trcli install-playwright
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
Expand Down Expand Up @@ -83,25 +83,34 @@ test: ## run tests quickly with the default Python
python3 tests/pytest/asyncio_prevent.py
pytest

# Default `FILE` to `e2e` if not specified
FILE:=tests/e2e
# Default `SUB_FILE` to empty
SUB_FILE:=

DEPLOYS_FILE:=tests/deploys
DEPLOYS_FILE:=tests/playwright/deploys

playwright-install:
install-playwright:
playwright install --with-deps

e2e: playwright-install ## end-to-end tests with playwright
pytest $(FILE) -m "not examples and not integrationtest"
install-trcli:
which trcli || pip install trcli

e2e-examples: playwright-install ## end-to-end tests on examples with playwright
pytest $(FILE) -m "examples"
install-rsconnect: ## install the main version of rsconnect till pypi version supports shiny express
pip install git+https://github.com/rstudio/rsconnect-python.git#egg=rsconnect-python

e2e-deploys: playwright-install ## end-to-end tests on deploys with playwright
pytest $(DEPLOYS_FILE) -s -m "integrationtest"
playwright-shiny: install-playwright ## end-to-end tests with playwright
pytest tests/playwright/shiny/$(SUB_FILE)

playwright-examples: install-playwright ## end-to-end tests on examples with playwright
pytest tests/playwright/examples

playwright-deploys: install-playwright install-rsconnect ## end-to-end tests on deploys with playwright
pytest tests/playwright/deploys/$(SUB_FILE) -s

testrail-junit: install-playwright install-trcli ## end-to-end tests with playwright and generate junit report
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml

coverage: ## check combined code coverage (must run e2e last)
pytest --cov-report term-missing --cov=shiny tests/pytest/ tests/e2e/ -m "not examples and not integrationtest"
pytest --cov-report term-missing --cov=shiny tests/pytest/ tests/playwright/shiny/$(SUB_FILE)
coverage html
$(BROWSER) htmlcov/index.html

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ To get started with shiny follow the [installation instructions](https://shiny.p
pip install shiny
```

To install the latest development version from this repository:
To install the latest development version:

``` sh
# First install htmltools, then shiny
pip install https://github.com/posit-dev/py-htmltools/tarball/main
pip install https://github.com/posit-dev/py-shiny/tarball/main
```

Expand All @@ -45,6 +47,8 @@ shiny run app.py --reload

## Development

API documentation for the `main` branch of Shiny: https://posit-dev.github.io/py-shiny/api/

If you want to do development on Shiny for Python:

``` sh
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ _inv/
_sidebar.yml
/.quarto/
objects.json
site_libs/
5 changes: 4 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ $(PYBIN): $(VENV)
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

dev-htmltools: $(PYBIN) ## Install development version of htmltools
$(PYBIN)/pip install https://github.com/rstudio/py-htmltools/tarball/main

deps: $(PYBIN) ## Install build dependencies
$(PYBIN)/pip install pip --upgrade
$(PYBIN)/pip install -e ..[doc]

quartodoc: ## Build qmd files for API docs
quartodoc: $(PYBIN) ## Build qmd files for API docs
. $(PYBIN)/activate \
&& quartodoc interlinks \
&& quartodoc build --config _quartodoc.yml --verbose
Expand Down
Loading

0 comments on commit 65829a3

Please sign in to comment.