Skip to content

Commit 41af702

Browse files
authored
Merge branch 'main' into bump_versions
2 parents b8b6d24 + b0396b9 commit 41af702

File tree

333 files changed

+13395
-7179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+13395
-7179
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Conventional Commits
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
jobs:
9+
conventional-commits:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: amannn/action-semantic-pull-request@v5
13+
id: lint
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
with:
17+
types: |
18+
build
19+
chore
20+
ci
21+
docs
22+
feat
23+
fix
24+
perf
25+
style
26+
refactor
27+
test
28+
- uses: marocchino/sticky-pull-request-comment@v2
29+
if: always() && (steps.lint.outputs.error_message != null)
30+
with:
31+
header: lint-error
32+
message: |
33+
Hey there! 👋
34+
35+
We noticed that the title of your pull request doesn't follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. To ensure consistency, we kindly ask you to adjust the title accordingly.
36+
37+
<details><summary>Additional details</summary>
38+
39+
${{ steps.lint.outputs.error_message }}
40+
41+
</details>
42+
43+
- if: ${{ steps.lint.outputs.error_message == null }}
44+
uses: marocchino/sticky-pull-request-comment@v2
45+
with:
46+
header: lint-error
47+
delete: true

.github/workflows/pytest.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ jobs:
185185
- name: Install node.js
186186
uses: actions/setup-node@v4
187187
with:
188-
node-version: "18"
189188
cache: npm
190189
cache-dependency-path: examples/brownian/shinymediapipe/package-lock.json
191190
- name: Install node.js package
@@ -204,6 +203,49 @@ jobs:
204203
path: test-results/
205204
retention-days: 5
206205

206+
playwright-ai:
207+
if: github.event_name != 'release'
208+
runs-on: ubuntu-latest
209+
strategy:
210+
matrix:
211+
python-version: ["3.12", "3.11", "3.10", "3.9"]
212+
browser: ["chromium", "firefox", "webkit"]
213+
exclude:
214+
- python-version: ${{ github.event.pull_request.draft && '3.11' }}
215+
- python-version: ${{ github.event.pull_request.draft && '3.10' }}
216+
- python-version: ${{ github.event.pull_request.draft && '3.9' }}
217+
- browser: ${{ github.event.pull_request.draft && 'firefox' }}
218+
- browser: ${{ github.event.pull_request.draft && 'webkit' }}
219+
fail-fast: false
220+
221+
steps:
222+
- uses: actions/checkout@v4
223+
with:
224+
fetch-depth: 0
225+
- name: Setup py-shiny
226+
uses: ./.github/py-shiny/setup
227+
with:
228+
python-version: ${{ matrix.python-version }}
229+
- name: Determine browsers for testing
230+
uses: ./.github/py-shiny/pytest-browsers
231+
id: browsers
232+
with:
233+
browser: ${{ matrix.browser }}
234+
# If anything other than `true`, it will heavily reduce webkit performance
235+
# Related: https://github.com/microsoft/playwright/issues/18119
236+
disable-playwright-diagnostics: ${{ matrix.browser == 'webkit' || matrix.browser == 'firefox' }}
237+
238+
- name: Run playwright tests for AI generated apps
239+
timeout-minutes: 60
240+
run: |
241+
make playwright-ai SUB_FILE=". --numprocesses 3 ${{ steps.browsers.outputs.playwright-diagnostic-args }}" ${{ steps.browsers.outputs.browsers }}
242+
- uses: actions/upload-artifact@v4
243+
if: failure() && steps.browsers.outputs.has-playwright-diagnostics
244+
with:
245+
name: "playright-ai-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.browser }}-results"
246+
path: test-results/
247+
retention-days: 5
248+
207249
playwright-deploys-precheck:
208250
if: github.event_name != 'release'
209251
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ docs/source/reference/
115115
_dev/
116116
tests/playwright/deploys/**/requirements.txt
117117
test-results/
118+
shiny_bookmarks/
119+
.posit/
118120

119121
# setuptools_scm
120122
shiny/_version.py

CHANGELOG.md

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [UNRELEASED]
99

10-
### Breaking changes
10+
## New features
1111

12-
* The navbar-related style options of `ui.page_navbar()` and `ui.navset_bar()` have been consolidated into a single `navbar_options` argument that pairs with a new `ui.navbar_options()` helper. Using the direct `position`, `bg`, `inverse`, `collapsible`, and `underline` arguments will continue to work with a deprecation message.
12+
* Added support for bookmarking Shiny applications. Bookmarking allows users to save the current state of an application and return to it later. This feature is available in both Shiny Core and Shiny Express. (#1870, #1915, #1919, #1920, #1922, #1934, #1938, #1945, #1955)
13+
* To enable bookmarking in Express mode, set `shiny.express.app_opts(bookmark_store=)` during the app's initial construction.
14+
* To enable bookmarking in Core mode, set `shiny.App(bookmark_store=)` when constructing the `app` object.
1315

14-
Related to this change, `ui.navset_bar()` now defaults to using `underline=True` so that it uses the same set of default `ui.navbar_options()` as the page variant. In `ui.navbar_options()`, `inverse` is replaced by `theme`, which takes values `"light"` (dark text on a **light** background), `"dark"` (light text on a **dark** background), or `"auto"` (follow page settings).
16+
* Added a new `.enable_bookmarking(client)` method to `ui.Chat()`. This method will attach bookmark hooks to save and restore the chat's messages and client state. (#1951, #1954)
17+
18+
* Both `ui.Chat()` and `ui.MarkdownStream()` now support the inclusion of Shiny UI elements inside of messages. This allows for gathering input from the user (e.g., `ui.input_select()`), displaying of rich output (e.g., `render.DataGrid()`), and more. (#1868)
19+
20+
* Added a new `.message_stream_context()` method to `ui.Chat()`. This context manager is a useful alternative to `.append_message_stream()` when you want to: (1) Nest a stream within another and/or
21+
(2) Overwrite/replace streaming content. (#1906)
22+
23+
### Changes
24+
25+
* Express mode's `app_opts()` requires all arguments to be keyword-only. If you are using positional arguments, you will need to update your code. (#1895)
26+
27+
* The `.get_latest_stream_result()` method on `ui.MarkdownStream()` was deprecated in favor of the new `.latest_stream` property. Call `.result()` on the property to get the latest result, `.status` to check the status, and `.cancel()` to cancel the stream.
28+
29+
* `MarkdownStream()` now has a default maximum width of `680px` for better readability. Also, similar to `Chat()`, it now also horizontally centers itself. (#1944)
30+
31+
* `ui.page_navbar()` and `ui.navset_bar()` now correctly apply `theme` and additional attributes from `navbar_options` created with `ui.navbar_options()`. (#1942)
32+
33+
### Bug fixes
34+
35+
* Fixed an issue where the `<main>` areas of `ui.page_sidebar()` and `ui.page_navbar()` (with a `sidebar`) were made to be a fillable containers even when `fillable=False`. (#1816)
36+
37+
* Fixed an issue where the `.update_user_input()` method on `ui.Chat()` isn't working in shinylive. (#1891)
38+
39+
* Fixed an issue where `width` and `height` on `MarkdownStream()` were not working as intended. (#1944)
40+
41+
* Fixed an issue with the `.click()` method on InputActionButton controllers in `shiny.playwright.controllers` where the method would not work as expected. (#1886)
42+
43+
## [1.3.0] - 2025-03-03
1544

1645
### New features
1746

@@ -31,30 +60,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3160

3261
* `shiny create` includes new and improved `ui.Chat()` template options. Most of these templates leverage the new [`{chatlas}` package](https://posit-dev.github.io/chatlas/), our opinionated approach to interfacing with various LLM. (#1806)
3362

34-
* Added a new `expect_max_height()` method to the Valuebox controllers to check the maximum height of a value box (#1816)
35-
3663
* Client data values (e.g., url info, output sizes/styles, etc.) can now be accessed in the server-side Python code via `session.clientdata`. For example, `session.clientdata.url_search()` reactively reads the URL search parameters. (#1832)
3764

3865
* Available `input` ids can now be listed via `dir(input)`. This also works on the new `session.clientdata` object. (#1832)
3966

67+
* `ui.input_text()`, `ui.input_text_area()`, `ui.input_numeric()` and `ui.input_password()` all gain an `update_on` option. `update_on="change"` is the default and previous behavior, where the input value updates immediately whenever the value changes. With `update_on="blur"`, the input value will update only when the text input loses focus or when the user presses Enter (or Cmd/Ctrl + Enter for `ui.input_text_area()`). (#1874)
68+
4069
* Added a new `.add_sass_layer_file()` method to `ui.Theme` that supports reading a Sass file with layer boundary comments, e.g. `/*-- scss:defaults --*/`. This format [is supported by Quarto](https://quarto.org/docs/output-formats/html-themes-more.html#bootstrap-bootswatch-layering) and makes it easier to store Sass rules and declarations that need to be woven into Shiny's Sass Bootstrap files. (#1790)
4170

42-
* `ui.input_text()`, `ui.input_text_area()`, `ui.input_numeric()` and `ui.input_password()` all gain an `update_on` option. `update_on="change"` is the default and previous behavior, where the input value updates immediately whenever the value changes. With `update_on="blur"`, the input value will update only when the text input loses focus or when the user presses Enter (or Cmd/Ctrl + Enter for `ui.input_text_area()`). (#1874)
71+
* Added a new `expect_max_height()` method to the Valuebox controllers to check the maximum height of a value box (#1816)
4372

4473
* `shiny.pytest.create_app_fixture(app)` gained support for multiple app file paths when creating your test fixture. If multiple file paths are given, it will behave as a parameterized fixture value and execute the test for each app path. (#1869)
4574

75+
### Breaking changes
76+
77+
* The navbar-related style options of `ui.page_navbar()` and `ui.navset_bar()` have been consolidated into a single `navbar_options` argument that pairs with a new `ui.navbar_options()` helper. Using the direct `position`, `bg`, `inverse`, `collapsible`, and `underline` arguments will continue to work with a deprecation message. (#1822)
78+
79+
Related to this change, `ui.navset_bar()` now defaults to using `underline=True` so that it uses the same set of default `ui.navbar_options()` as the page variant. In `ui.navbar_options()`, `inverse` is replaced by `theme`, which takes values `"light"` (dark text on a **light** background), `"dark"` (light text on a **dark** background), or `"auto"` (follow page settings).
80+
81+
* The Shiny Core component `shiny.ui.Chat()` no longer has a `.ui()` method. This method was never intended to be used in Shiny Core (in that case, use `shiny.ui.chat_ui()`) to create the UI element. Note that the `shiny.express.ui.Chat()` class still has a `.ui()` method. (#1840)
82+
4683
### Bug fixes
4784

4885
* `ui.Chat()` now correctly handles new `ollama.chat()` return value introduced in `ollama` v0.4. (#1787)
4986

5087
* Updated `expect_height()` for Valuebox controllers to check the height property instead of max-height. (#1816)
5188

52-
### Changes
53-
54-
* The Shiny Core component `shiny.ui.Chat()` no longer has a `.ui()` method. This method
55-
was never intended to be used in Shiny Core (in that case, use `shiny.ui.chat_ui()`) to create the UI element. Note that the `shiny.express.ui.Chat()`
56-
class still has a `.ui()` method. (#1840)
57-
5889
## [1.2.1] - 2024-11-14
5990

6091
### Bug fixes

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include LICENSE
22

33
recursive-include tests *
44
recursive-exclude * __pycache__
5+
recursive-exclude * shiny_bookmarks
56
recursive-exclude * *.py[co]
67

78
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ TEST_FILE:=tests/playwright/$(SUB_FILE)
157157
DEPLOYS_TEST_FILE:=tests/playwright/deploys$(SUB_FILE)
158158
SHINY_TEST_FILE:=tests/playwright/shiny/$(SUB_FILE)
159159
EXAMPLES_TEST_FILE:=tests/playwright/examples/$(SUB_FILE)
160+
AI_TEST_FILE:=tests/playwright/ai_generated_apps/$(SUB_FILE)
160161

161162
install-playwright: FORCE
162163
playwright install --with-deps
@@ -187,6 +188,10 @@ playwright-deploys: FORCE
187188
playwright-examples: FORCE
188189
$(MAKE) playwright TEST_FILE="$(EXAMPLES_TEST_FILE)"
189190

191+
# end-to-end tests for all AI generated apps
192+
playwright-ai: FORCE
193+
$(MAKE) playwright TEST_FILE="$(AI_TEST_FILE)"
194+
190195
coverage: FORCE ## check combined code coverage (must run e2e last)
191196
pytest --cov-report term-missing --cov=shiny tests/pytest/ $(SHINY_TEST_FILE) $(PYTEST_BROWSERS)
192197
coverage html

docs/_quartodoc-core.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ quartodoc:
9898
- ui.input_file
9999
- ui.download_button
100100
- ui.download_link
101+
- title: Bookmarking
102+
desc: Saving and restoring app state
103+
contents:
104+
- ui.input_bookmark_button
105+
- bookmark.restore_input
106+
- bookmark.Bookmark
107+
- bookmark.BookmarkState
108+
- bookmark.RestoreState
109+
- kind: page
110+
path: bookmark_integration
111+
summary:
112+
name: "Integration"
113+
desc: "Decorators to set save and restore directories."
114+
flatten: true
115+
contents:
116+
- bookmark.set_global_save_dir_fn
117+
- bookmark.set_global_restore_dir_fn
101118
- title: Chat interface
102119
desc: Build a chatbot interface
103120
contents:

0 commit comments

Comments
 (0)