Skip to content

Commit 9c27d5f

Browse files
authored
Merge branch 'main' into allow-custom-local-app-names-testing
2 parents bfdc4b7 + ba3a4b2 commit 9c27d5f

Some content is hidden

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

57 files changed

+7643
-24616
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
* Add a `data-suggestion` attribute to an HTML element, and set the value to the input suggestion text (e.g., `<span data-suggestion="Suggestion value">Suggestion link</span>`)
1717
* To auto-submit the suggestion when clicked by the user, include the `.submit` class or the `data-suggestion-submit="true"` attribute on the HTML element. Alternatively, use Cmd/Ctrl + click to auto-submit any suggestion or Alt/Opt + click to apply any suggestion to the chat input without submitting.
1818

19-
* 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)
20-
21-
* The `ui.Chat()` component gains the following:
19+
* The `ui.Chat()` component also gains the following:
2220
* The `.on_user_submit()` decorator method now passes the user input to the decorated function. This makes it a bit easier to access the user input. See the new templates (mentioned below) for examples. (#1801)
21+
* The assistant icon is now configurable via `ui.chat_ui()` (or the `ui.Chat.ui()` method in Shiny Express) or for individual messages in the `.append_message()` and `.append_message_stream()` methods of `ui.Chat()`. (#1853)
2322
* A new `get_latest_stream_result()` method was added for an easy way to access the final result of the stream when it completes. (#1846)
2423
* The `.append_message_stream()` method now returns the `reactive.extended_task` instance that it launches. (#1846)
24+
* The `ui.Chat()` component's `.update_user_input()` method gains `submit` and `focus` options that allow you to submit the input on behalf of the user and to choose whether the input receives focus after the update. (#1851)
2525

2626
* `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)
2727

2828
* 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)
2929

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

32-
* The `ui.Chat()` component's `.update_user_input()` method gains `submit` and `focus` options that allow you to submit the input on behalf of the user and to choose whether the input receives focus after the update. (#1851)
32+
* 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)
3333

34-
* The assistant icons is now configurable via `ui.chat_ui()` (or the `ui.Chat.ui()` method in Shiny Express) or for individual messages in the `.append_message()` and `.append_message_stream()` methods of `ui.Chat()`. (#1853)
34+
* `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)
3535

3636
* `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)
3737

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ git fetch --tags upstream
5858
Then install:
5959

6060
```sh
61-
pip install -e ".[dev,test]"
61+
pip install -e ".[dev,test,doc]"
6262
```
6363

6464
Additionally, you can install pre-commit hooks which will automatically reformat and lint the code when you make a commit:
@@ -69,3 +69,29 @@ pre-commit install
6969
# To disable:
7070
# pre-commit uninstall
7171
```
72+
73+
Tests should now pass:
74+
75+
```sh
76+
make check
77+
# To apply formatting fixes instead of erroring:
78+
# make check-fix
79+
```
80+
81+
Or get a full list of helpers with just:
82+
83+
```sh
84+
make
85+
```
86+
87+
Typically, when developing new features for Shiny, you'll want to try them out in an application.
88+
In a **separate** application directory, use can use `-e` to reference your local checkout of `py-shiny`:
89+
90+
```sh
91+
# Rather than
92+
# pip install shiny
93+
# run:
94+
pip install -e ../py-shiny --config-settings editable_mode=compat
95+
```
96+
97+
See the [docs README](docs/README.md) for instructions on building the documentation locally.

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This directory contains files to generate Shiny for Python API documentation, us
55

66
## Building the docs
77

8-
To build the docs, first install the Python dependencies and Quarto extensions:
8+
To build the docs, first [download and install Quarto](https://quarto.org/docs/get-started/), and then install the Python dependencies and Quarto extensions:
99

1010
```bash
1111
# Install build dependencies
@@ -18,14 +18,14 @@ After those dependencies are installed, build the .qmd files for Shiny, using qu
1818
make quartodoc
1919
```
2020

21-
Then build the web site using Quarto:
21+
Then you can build the docs, and serve them locally, and watch for changes to the .qmd files:
2222

2323
```bash
24-
make site
24+
make serve
2525
```
2626

27-
Alternatively, running `make serve` will build the docs, and serve them locally, and watch for changes to the .qmd files:
27+
Alternatively, build the site just once:
2828

2929
```bash
30-
make serve
30+
make site
3131
```

docs/_quartodoc-testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ quartodoc:
2424
- title: UI Inputs
2525
desc: Methods for interacting with Shiny app input value controller.
2626
contents:
27+
- playwright.controller.InputActionButton
2728
- playwright.controller.InputActionLink
2829
- playwright.controller.InputCheckbox
2930
- playwright.controller.InputCheckboxGroup

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ dependencies = [
5050
]
5151

5252
[project.optional-dependencies]
53-
theme = [
54-
"libsass>=0.23.0",
55-
"brand_yml>=0.1.0"
56-
]
53+
theme = ["libsass>=0.23.0", "brand_yml>=0.1.0"]
5754
test = [
5855
"pytest>=6.2.4",
5956
"pytest-asyncio>=0.17.2",
@@ -103,7 +100,7 @@ dev = [
103100
"isort>=5.10.1",
104101
"libsass>=0.23.0",
105102
"brand_yml>=0.1.0",
106-
"pyright>=1.1.383",
103+
"pyright>=1.1.383,<1.1.395",
107104
"pre-commit>=2.15.0",
108105
"wheel",
109106
"matplotlib",
@@ -158,7 +155,16 @@ ignore = ["E302", "E501", "F403", "F405", "W503", "E203", "E701", "E704"]
158155

159156
[tool.isort]
160157
profile = "black"
161-
skip = ["__init__.py", "typings/", "_dev/", ".venv", "venv", ".tox", "build", "_version.py"]
158+
skip = [
159+
"__init__.py",
160+
"typings/",
161+
"_dev/",
162+
".venv",
163+
"venv",
164+
".tox",
165+
"build",
166+
"_version.py",
167+
]
162168

163169
[tool.mypy]
164170
# The goal of our usage of mypy is to make to sure mypy can run, not that it catches any errors (we use pyright to find our errors).

scripts/_pkg-sources.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
list(
2-
bslib = "rstudio/bslib@b54bfb5de82f76bc044c4c661995af3a63e7ab29",
3-
shiny = "rstudio/shiny@c489fef4ff46fc37eb2a7c447a7108afde7ad124",
2+
bslib = "rstudio/bslib@main",
3+
shiny = "rstudio/shiny@main",
44
sass = "sass",
55
htmltools = "rstudio/htmltools@main"
66
)

shiny/_versions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
shiny_html_deps = "1.9.1.9000"
2-
bslib = "0.8.0.9000"
1+
shiny_html_deps = "1.10.0.9000"
2+
bslib = "0.9.0.9000"
33
htmltools = "0.5.8.9000"
44
bootstrap = "5.3.1"
55
requirejs = "2.3.6"

shiny/ui/_input_numeric.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__all__ = ("input_numeric",)
22

3-
from typing import Optional
3+
from typing import Literal, Optional
44

55
from htmltools import Tag, TagChild, css, div, tags
66

@@ -19,6 +19,7 @@ def input_numeric(
1919
max: Optional[float] = None,
2020
step: Optional[float] = None,
2121
width: Optional[str] = None,
22+
update_on: Literal["change", "blur"] = "change",
2223
) -> Tag:
2324
"""
2425
Create an input control for entry of numeric values.
@@ -39,6 +40,11 @@ def input_numeric(
3940
Interval to use when stepping between min and max.
4041
width
4142
The CSS width, e.g. '400px', or '100%'
43+
update_on
44+
When should the input value be updated? Options are `"change"` (default) and
45+
`"blur"`. Use `"change"` to update the input immediately whenever the value
46+
changes. Use `"blur"`to delay the input update until the input loses focus (the
47+
user moves away from the input), or when Enter is pressed.
4248
4349
Returns
4450
-------
@@ -67,6 +73,7 @@ def input_numeric(
6773
min=min,
6874
max=max,
6975
step=step,
76+
data_update_on=update_on,
7077
),
7178
class_="form-group shiny-input-container",
7279
style=css(width=width),

shiny/ui/_input_password.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__all__ = ("input_password",)
22

3-
from typing import Optional
3+
from typing import Literal, Optional
44

55
from htmltools import Tag, TagChild, css, div, tags
66

@@ -17,6 +17,7 @@ def input_password(
1717
*,
1818
width: Optional[str] = None,
1919
placeholder: Optional[str] = None,
20+
update_on: Literal["change", "blur"] = "change",
2021
) -> Tag:
2122
"""
2223
Create an password control for entry of passwords.
@@ -33,6 +34,11 @@ def input_password(
3334
The CSS width, e.g., '400px', or '100%'.
3435
placeholder
3536
The placeholder of the input.
37+
update_on
38+
When should the input value be updated? Options are `"change"` (default) and
39+
`"blur"`. Use `"change"` to update the input immediately whenever the value
40+
changes. Use `"blur"`to delay the input update until the input loses focus (the
41+
user moves away from the input), or when Enter is pressed.
3642
3743
Returns
3844
-------
@@ -58,6 +64,7 @@ def input_password(
5864
value=value,
5965
class_="shiny-input-password form-control",
6066
placeholder=placeholder,
67+
data_update_on=update_on,
6168
),
6269
class_="form-group shiny-input-container",
6370
style=css(width=width),

shiny/ui/_input_text.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def input_text(
2020
placeholder: Optional[str] = None,
2121
autocomplete: Optional[str] = "off",
2222
spellcheck: Optional[Literal["true", "false"]] = None,
23+
update_on: Literal["change", "blur"] = "change",
2324
) -> Tag:
2425
"""
2526
Create an input control for entry of text values.
@@ -45,6 +46,11 @@ def input_text(
4546
spellcheck
4647
Whether to enable browser spell checking of the text input (default is ``None``). If
4748
None, then it will use the browser's default behavior.
49+
update_on
50+
When should the input value be updated? Options are `"change"` (default) and
51+
`"blur"`. Use `"change"` to update the input immediately whenever the value
52+
changes. Use `"blur"`to delay the input update until the input loses focus (the
53+
user moves away from the input), or when Enter is pressed.
4854
4955
Returns
5056
-------
@@ -74,6 +80,7 @@ def input_text(
7480
placeholder=placeholder,
7581
autocomplete=autocomplete,
7682
spellcheck=spellcheck,
83+
data_update_on=update_on,
7784
),
7885
class_="form-group shiny-input-container",
7986
style=css(width=width),
@@ -95,6 +102,7 @@ def input_text_area(
95102
autoresize: bool = False,
96103
autocomplete: Optional[str] = None,
97104
spellcheck: Optional[Literal["true", "false"]] = None,
105+
update_on: Literal["change", "blur"] = "change",
98106
) -> Tag:
99107
"""
100108
Create a textarea input control for entry of unstructured text values.
@@ -137,6 +145,11 @@ def input_text_area(
137145
spellcheck
138146
Whether to enable browser spell checking of the text input (default is ``None``). If
139147
None, then it will use the browser's default behavior.
148+
update_on
149+
When should the input value be updated? Options are `"change"` (default) and
150+
`"blur"`. Use `"change"` to update the input immediately whenever the value
151+
changes. Use `"blur"`to delay the input update until the input loses focus (the
152+
user moves away from the input), or when Ctrl/Cmd + Enter is pressed.
140153
141154
Returns
142155
-------
@@ -176,6 +189,7 @@ def input_text_area(
176189
cols=cols,
177190
autocomplete=autocomplete,
178191
spellcheck=spellcheck,
192+
data_update_on=update_on,
179193
)
180194

181195
return div(

0 commit comments

Comments
 (0)