Skip to content

Commit

Permalink
Merge branch 'main' into update-pyright
Browse files Browse the repository at this point in the history
* main: (56 commits)
  Add actions step for nightly reporting -> Testrail (#774)
  Remove unused entry in manifest
  Bump version to 0.6.0.9000
  Use latest htmltools
  Bump version to v0.6.0; Rearrange news to have API changes last
  Tweaks from testing
  Fix default width/height with implicit plot output (#792)
  Update deps (#794)
  Remove deprecated 'name' parameter from `Outputs` (#791)
  api(ui): Drop `toggle_` methods. Consolidate update accordion methods. Stronger typing for `layout_sidebar(sidebar)` and `page_sidebar(sidebar)` (#788)
  bug(sidebar): Revert sidebar icon back to chevron (#789)
  For `input_action_button`, default to having whitespace around button (#758)
  Remove output from template app (#775)
  Add output_args and suspend_display decorators (#786)
  Update value_box; Update to bootstrap 5.3; Update htmldeps (#772)
  tests: add sidebar test (#787)
  Seaborn plots should fill their output_plot (#785)
  Kwargs to uvicorn run (#780)
  Add width and height arguments to `@render.plot` (#783)
  gitgnore dist/
  ...
  • Loading branch information
schloerke committed Nov 2, 2023
2 parents 2301a1a + c6d6bee commit 4d3b8c8
Show file tree
Hide file tree
Showing 366 changed files with 16,544 additions and 48,913 deletions.
87 changes: 85 additions & 2 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 @@ -66,7 +68,7 @@ jobs:
run: |
make e2e
examples:
e2e-examples:
runs-on: ${{ matrix.os }}
if: github.event_name != 'release'
strategy:
Expand Down Expand Up @@ -97,7 +99,35 @@ jobs:
run: |
make e2e-examples
deploy:
e2e-deploys:
# Only allow one `e2e-deploys` job to run at a time. (Independent of branch / PR)
concurrency: e2e-deploys
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'deploy')) }}
strategy:
matrix:
python-version: ["3.10"]
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 example app tests
env:
DEPLOY_CONNECT_SERVER_URL: "https://rsc.radixu.com/"
DEPLOY_CONNECT_SERVER_API_KEY: "${{ secrets.DEPLOY_CONNECT_SERVER_API_KEY }}"
DEPLOY_SHINYAPPS_NAME: "${{ secrets.DEPLOY_SHINYAPPS_NAME }}"
DEPLOY_SHINYAPPS_TOKEN: "${{ secrets.DEPLOY_SHINYAPPS_TOKEN }}"
DEPLOY_SHINYAPPS_SECRET: "${{ secrets.DEPLOY_SHINYAPPS_SECRET }}"
run: |
make e2e-deploys
pypi:
name: "Deploy to PyPI"
runs-on: ubuntu-latest
if: github.event_name == 'release'
Expand Down Expand Up @@ -133,3 +163,56 @@ 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
run: |
make e2e-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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ parts/
sdist/
var/
wheels/
dist/
*.egg-info/
.installed.cfg
*.egg
Expand Down
117 changes: 107 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,109 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### New features

* Added `shiny.render.renderer_components` decorator to help create new output renderers. (#621)
### Bug fixes

### Other changes


## [0.6.0] - 2023-08-08

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

### New features
* `shiny run` now takes `reload-includes` and `reload-excludes` to allow you to define which files trigger a reload (#780).
* `shiny.run` now passes keyword arguments to `uvicorn.run` (#780).
* The `@output` decorator is no longer required for rendering functions; `@render.xxx` decorators now register themselves automatically. You can still use `@output` explicitly if you need to set specific output options (#747).
* Added support for integration with Quarto (#746).
* Added `shiny.render.renderer_components` decorator to help create new output renderers (#621).
* Added `shiny.experimental.ui.popover()`, `update_popover()`, and `toggle_popover()` for easy creation (and server-side updating) of [Bootstrap popovers](https://getbootstrap.com/docs/5.3/components/popovers/). Popovers are similar to tooltips, but are more persistent, and should primarily be used with button-like UI elements (e.g. `input_action_button()` or icons) (#680).
* Added CSS classes to UI input methods (#680) .
* `Session` objects can now accept an asynchronous (or synchronous) function for `.on_flush(fn=)`, `.on_flushed(fn=)`, and `.on_ended(fn=)` (#686).
* `App()` now allows `static_assets` to represent multiple paths. To do this, pass in a dictionary instead of a string (#763).
* The `showcase_layout` argument of `value_box()` now accepts one of three character values: `"left center"`, `"top right"`, `"bottom"`. (#772)
* `value_box()` now supports many new themes and styles, or fully customizable themes using the new `value_box_theme()` function. To reflect the new capabilities, we've replaced `theme_color` with a new `theme` argument. The previous argument will continue work as expected, but with a deprecation warning. (#772)

In addition to the Bootstrap theme names (`primary` ,`secondary`, etc.), you can now use the main Boostrap colors (`purple`, `blue`, `red`, etc.). You can also choose to apply the color to the background or foreground by prepending a `bg-` or `text-` prefix to the theme or color name. Finally, we've also added new gradient themes allowing you to pair any two color names as `bg-gradient-{from}-{to}` (e.g., `bg-gradient-purple-blue`).

These named color themes aren't limited to value boxes: because they're powered by small utility classes, you can use them anywhere within your bslib-powered UI.

* 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)
* `shiny.ui.layout_column_wrap(width, *args)` was rearranged to `shiny.ui.layout_column_wrap(*args, width)`. Now, `width` will default to `200px` is no value is provided. (#772)
* `shiny.ui.showcase_left_center()` and `shiny.ui.showcase_top_right()` no longer take two values for the `width` argument. Instead, they now take a single value (e.g., `width = "30%"`) representing the width of the showcase are in the value box. Furthermore, they've both gained `width_full_screen` arguments that determine the width of the showcase area when the value box is expanded to fill the screen. (#772)
* `shiny.ui.panel_main()` and `shiny.ui.panel_sidebar()` are deprecated in favor of new API for `shiny.ui.layout_sidebar()`. Please use `shiny.ui.sidebar()` to construct a `sidebar=` and supply it to `shiny.ui.layout_sidebar(sidebar, *args, **kwargs)`. (#788)
* `shiny.experimental.ui.toggle_sidebar()` has been renamed to `shiny.ui.update_sidebar()`. It's `open` value now only supports `bool` values. (#788)

#### API relocations

* `shiny.ui`'s `navset_pill_card()` and `navset_tab_card()` have been renamed to `navset_card_pill()` and `navset_card_tab()` respectively (#492).

The following methods have been moved from `shiny.experimental.ui` and integrated into `shiny.ui` (final locations under `shiny.ui` are displayed) (#680):

* Sidebar - Sidebar layout or manipulation
* `sidebar()`, `page_sidebar()`, `update_sidebar()`, `layout_sidebar()`, `Sidebar`
* Filling layout - Allow UI components to expand into the parent container and/or allow its content to expand
* `page_fillable()`, `fill.as_fillable_container()`, `fill.as_fill_item()`, `fill.remove_all_fill()`
* `output_plot(fill=)`, `output_image(fill=)`, `output_ui(fill=, fillable=)`
* CSS units - CSS units and padding
* `css.as_css_unit()`, `css.as_css_padding()`, `css.CssUnit`
* Tooltip - Hover-based context UI element
* `tooltip()`, `update_tooltip()`
* Popover - Click-based context UI element
* `popover()`, `update_popover()`
* Accordion - Vertically collapsible UI element
* `accordion()`, `accordion_panel()`, `insert_accordion_panel()`, `remove_accordion_panel()`, `update_accordion()`, `update_accordion_panel()`, `Accordion`, `AccordionPanel`
* Card - A general purpose container for grouping related UI elements together
* `card()`, `card_header()`, `card_footer()`, `CardItem`
* Valuebox - Opinionated container for displaying a value and title
* `valuebox()`
* `showcase_left_center()`
* `showcase_top_right()`
* Navs - Navigation within a page
* `navset_bar()`, `navset_tab_card()`, `navset_pill_card()`
* `page_navbar(sidebar=, fillable=, fillable_mobile=, gap=, padding=)`, `navset_card_tab(sidebar=)`, `navset_card_pill(sidebar=)`, `navset_bar(sidebar=, fillable=, gap=, padding=)`
* Layout - Layout of UI elements
* `layout_column_wrap()`
* Inputs - UI elements for user input
* `input_text_area(autoresize=)`

If a ported method is called from `shiny.experimental.ui`, a deprecation warning will be displayed.

Methods still under consideration in `shiny.experimental.ui`:
* `card(wrapper=)`: A function (which returns a UI element) to call on unnamed arguments in `card(*args)` which are not already `shiny.ui.CardItem` objects.
* `card_body()`: A container for grouping related UI elements together
* `card_image()`: A general container for an image within a `shiny.ui.card`.
* `card_title()`: A general container for the "title" of a `shiny.ui.card`.

#### API removals

* `shiny.experimental.ui.FillingLayout` has been removed. (#481)
* `shiny.experimental.ui.toggle_switch()` has been made defunct. Please remove it from your code and use `shiny.ui.update_switch()` instead. (#772)
* `shiny.experimental.ui.as_width_unit()` has been made defunct. Please remove it from your code. (#772)
* `shiny.experimental.ui`' `as_fill_carrier()`, `is_fill_carrier()`, `is_fillable_container()`, and `is_fill_item()` have been made defunct. Remove them from your code. (#680, #788)
* 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)


## [0.5.1] - 2023-08-08

Expand Down Expand Up @@ -166,35 +263,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### New features

* Closed [#312](https://github.com/rstudio/py-shiny/issues/312): Matplotlib plots in a `@render.plot` can now use the global figure, instead of returning a `figure` object. ([#314](https://github.com/rstudio/py-shiny/pull/314))
* Closed [#312](https://github.com/posit-dev/py-shiny/issues/312): Matplotlib plots in a `@render.plot` can now use the global figure, instead of returning a `figure` object. ([#314](https://github.com/posit-dev/py-shiny/pull/314))

* Disabled `shiny static` command, in favor of `shinylive export` from the shinylive package. ([#326](https://github.com/rstudio/py-shiny/pull/326))
* Disabled `shiny static` command, in favor of `shinylive export` from the shinylive package. ([#326](https://github.com/posit-dev/py-shiny/pull/326))


## [0.2.5] - 2022-08-12

### New features

* Closed [#269](https://github.com/rstudio/py-shiny/issues/269): The UI for a `shiny.App` object can now be provided as a function. ([#299](https://github.com/rstudio/py-shiny/pull/299))
* When a Shinylive deployment is made with `shiny static`, it the deployment code is now delegated to Shinylive. ([#310](https://github.com/rstudio/py-shiny/pull/310))
* Closed [#269](https://github.com/posit-dev/py-shiny/issues/269): The UI for a `shiny.App` object can now be provided as a function. ([#299](https://github.com/posit-dev/py-shiny/pull/299))
* When a Shinylive deployment is made with `shiny static`, it the deployment code is now delegated to Shinylive. ([#310](https://github.com/posit-dev/py-shiny/pull/310))

### Bug fixes

* Fixed [#279](https://github.com/rstudio/py-shiny/issues/279): When a Shiny application is mounted to a Starlette route, reactivity did not work. ([#294](https://github.com/rstudio/py-shiny/pull/294))
* Fixed [#290](https://github.com/rstudio/py-shiny/issues/290): `@render.plot` now works as intended inside `@module.server`. ([#292](https://github.com/rstudio/py-shiny/pull/292))
* Fixed [#289](https://github.com/rstudio/py-shiny/issues/289): `input_selectize()` now resolves the input id before using for other id-like attributes ([#291](https://github.com/rstudio/py-shiny/pull/291))
* Fixed [#279](https://github.com/posit-dev/py-shiny/issues/279): When a Shiny application is mounted to a Starlette route, reactivity did not work. ([#294](https://github.com/posit-dev/py-shiny/pull/294))
* Fixed [#290](https://github.com/posit-dev/py-shiny/issues/290): `@render.plot` now works as intended inside `@module.server`. ([#292](https://github.com/posit-dev/py-shiny/pull/292))
* Fixed [#289](https://github.com/posit-dev/py-shiny/issues/289): `input_selectize()` now resolves the input id before using for other id-like attributes ([#291](https://github.com/posit-dev/py-shiny/pull/291))

## [0.2.4] - 2022-08-01

### Bug fixes

* Fixed [#287](https://github.com/rstudio/py-shiny/issues/287): Running `shiny static` on Windows failed with `PermissionError`. ([#288](https://github.com/rstudio/py-shiny/pull/288))
* Fixed [#287](https://github.com/posit-dev/py-shiny/issues/287): Running `shiny static` on Windows failed with `PermissionError`. ([#288](https://github.com/posit-dev/py-shiny/pull/288))

## [0.2.3] - 2022-07-28

### Bug fixes

* Fixed [#281](https://github.com/rstudio/py-shiny/issues/281): Directory creation for Shinylive assets could fail if the parent directory did not exist. ([#283](https://github.com/rstudio/py-shiny/pull/283))
* Fixed [#281](https://github.com/posit-dev/py-shiny/issues/281): Directory creation for Shinylive assets could fail if the parent directory did not exist. ([#283](https://github.com/posit-dev/py-shiny/pull/283))

## [0.2.2] - 2022-07-27

Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ message: "If you use this software, please cite it as below."
authors:
- name: "The Shiny development team"
license: MIT
license-url: "https://github.com/rstudio/py-shiny/blob/main/LICENSE"
repository-code: "https://github.com/rstudio/py-shiny"
license-url: "https://github.com/posit-dev/py-shiny/blob/main/LICENSE"
repository-code: "https://github.com/posit-dev/py-shiny"
type: software
url: "https://shiny.posit.co/py/"
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ 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 *
37 changes: 25 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ typings/matplotlib/__init__.pyi: ## grab type stubs from GitHub
mv typings/python-type-stubs/stubs/matplotlib typings/
rm -rf typings/python-type-stubs

pyright: typings/uvicorn typings/matplotlib/__init__.pyi ## type check with pyright
typings/seaborn:
pyright --createstub seaborn

pyright: typings/uvicorn typings/matplotlib/__init__.pyi typings/seaborn ## type check with pyright
pyright

lint: ## check style with flake8
Expand All @@ -77,27 +80,37 @@ check: ## check code quality with black and isort
isort --check-only --diff .

test: ## run tests quickly with the default Python
python3 tests/asyncio_prevent.py
pytest tests
python3 tests/pytest/asyncio_prevent.py
pytest

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

e2e: ## end-to-end tests with playwright
playwright install --with-deps
pytest $(FILE) -m "not examples"
DEPLOYS_FILE:=tests/deploys

e2e-examples: ## end-to-end tests on examples with playwright
playwright-install:
playwright install --with-deps

trcli-install:
which trcli || pip install trcli

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

e2e-examples: playwright-install ## end-to-end tests on examples with playwright
pytest $(FILE) -m "examples"

coverage: ## check code coverage quickly with the default Python
coverage run --source shiny -m pytest
coverage report -m
e2e-deploys: playwright-install ## end-to-end tests on deploys with playwright
pytest $(DEPLOYS_FILE) -s -m "integrationtest"

e2e-junit: playwright-install trcli-install ## end-to-end tests with playwright and generate junit report
pytest $(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"
coverage html
$(BROWSER) htmlcov/index.html


release: dist ## package and upload a release
twine upload dist/*

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pip install shiny
To install the latest development version from this repository:

``` sh
pip install https://github.com/rstudio/py-shiny/tarball/main
pip install https://github.com/posit-dev/py-shiny/tarball/main
```

You can create and run your first application with:
Expand Down
Loading

0 comments on commit 4d3b8c8

Please sign in to comment.