Skip to content

Commit f11769f

Browse files
committed
Merge branch 'main' into machow-feat-narwhals
* main: setup.cfg -> pyproject.toml (posit-dev#1625) docs(navset): Add server function to navset docs (posit-dev#1596) Pin syrupy to avoid pytest-rerunfailures incompatibility (posit-dev#1632) refactor: `shiny create` and `shiny add test` supporting functions (posit-dev#1629) Update CHANGELOG.md Fix posit-dev#1601: Force text/javascript for .js files Work around griffe 1.0 breaking changes feat(shiny create): Support simpler syntax for `--github` flag (posit-dev#1623) Make sure `Chat.messages(format='google')` converts role assistant -> model (posit-dev#1622) Fix `NormalizerRegistry.register()` (posit-dev#1619) Update JS/CSS from shiny and bslib (posit-dev#1617) Add ability to update `Chat()`'s input placeholder (posit-dev#1594) docs: Add double-quotes to shiny[theme] (posit-dev#1605) `json.dump()` each websocket message once instead of twice (posit-dev#1597) docs: Update note on style keys allowing for kebab-case (posit-dev#1595) docs: fix navset function links (posit-dev#1590) Get `ui.Chat()` working inside Shiny modules (posit-dev#1582) bug(notification): Allow for duration to be `None` and passed to client (posit-dev#1577) Fix logic for detection of support files in docs (posit-dev#1580) docs(navset): Add examples for navset (posit-dev#1579)
2 parents a5714e4 + 77a6792 commit f11769f

File tree

85 files changed

+9371
-8486
lines changed

Some content is hidden

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

85 files changed

+9371
-8486
lines changed

.github/workflows/build-docs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2325

2426
- name: Setup py-shiny
2527
uses: ./.github/py-shiny/setup

.github/workflows/deploy-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2325
- name: Setup py-shiny
2426
uses: ./.github/py-shiny/setup
2527
with:

.github/workflows/pytest.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030

3131
steps:
3232
- uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
3335
- name: Setup py-shiny
3436
id: install
3537
uses: ./.github/py-shiny/setup
@@ -63,6 +65,8 @@ jobs:
6365
needs: [check]
6466
steps:
6567
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
6670
- name: "Set up Python 3.10"
6771
uses: actions/setup-python@v4
6872
with:
@@ -117,6 +121,8 @@ jobs:
117121

118122
steps:
119123
- uses: actions/checkout@v4
124+
with:
125+
fetch-depth: 0
120126
- name: Setup py-shiny
121127
uses: ./.github/py-shiny/setup
122128
with:
@@ -159,6 +165,8 @@ jobs:
159165

160166
steps:
161167
- uses: actions/checkout@v4
168+
with:
169+
fetch-depth: 0
162170
- name: Setup py-shiny
163171
uses: ./.github/py-shiny/setup
164172
with:
@@ -205,6 +213,8 @@ jobs:
205213

206214
steps:
207215
- uses: actions/checkout@v4
216+
with:
217+
fetch-depth: 0
208218
- name: Setup py-shiny
209219
uses: ./.github/py-shiny/setup
210220
with:

.github/workflows/verify-js-built.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
1416

1517
- name: Extract node version from .nvmrc
1618
id: nvm

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,6 @@ docs/source/reference/
115115
_dev/
116116
tests/playwright/deploys/**/requirements.txt
117117
test-results/
118+
119+
# setuptools_scm
120+
shiny/_version.py

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### New features
1111

12+
* `ui.Chat()` gains a new `.update_user_input()` method, which adds the ability to update the input placeholder message. As a result, `.set_user_message()` is now deprecated (since the new method can also be used to update the message). (#1594)
13+
14+
* `shiny create` now supports a succinct format for specifying the GitHub repository via the `--github` flag, e.g. `--github posit-dev/py-shiny-templates`. You can now also use `--github` and `--template` together, in which case `--github` should point to a repository containing a directory matching the name provided in `--template`. (#1623)
15+
1216
### Other changes
1317

1418
### Bug fixes
1519

16-
* An empty `input_date()` value no longer crashes Shiny. (#1528)
20+
* A handful of fixes for `ui.Chat()`, including:
21+
* A fix for use inside Shiny modules. (#1582)
22+
* `.messages(format="google")` now returns the correct role. (#1622)
23+
24+
* An empty `ui.input_date()` value no longer crashes Shiny. (#1528)
1725

1826
* Fixed bug where calling `.update_filter(None)` on a data frame renderer did not visually reset non-numeric column filters. (It did reset the column's filtering, just not the label). Now it resets filter's label. (#1557)
1927

2028
* Require shinyswatch >= 0.7.0 and updated examples accordingly. (#1558)
2129

22-
* `input_text_area(autoresize=True)` now resizes properly even when it's not visible when initially rendered (e.g. in a closed accordion or a hidden tab). (#1560)
30+
* `ui.input_text_area(autoresize=True)` now resizes properly even when it's not visible when initially rendered (e.g. in a closed accordion or a hidden tab). (#1560)
2331

24-
### Bug fixes
32+
* `ui.notification_show(duration=None)` now persists the notification until the app user closes it. (#1577)
33+
34+
* Some copies of Windows 10 have registry entries mapping .js files to content type "text/plain", which was causing all sorts of problems for browsers. (#1624)
2535

2636
### Deprecations
2737

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ release: dist ## package and upload a release
188188
twine upload dist/*
189189

190190
dist: clean ## builds source and wheel package
191-
pip install setuptools
192-
python setup.py sdist
193-
python setup.py bdist_wheel
191+
pip install build
192+
python -m build --sdist
193+
python -m build --wheel
194194
ls -l dist
195195

196196

js/chat/chat.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ type requestScrollEvent = {
2727
cancelIfScrolledUp: boolean;
2828
};
2929

30+
type UpdateUserInput = {
31+
value?: string;
32+
placeholder?: string;
33+
};
34+
3035
// https://github.com/microsoft/TypeScript/issues/28357#issuecomment-748550734
3136
declare global {
3237
interface GlobalEventHandlersEventMap {
3338
"shiny-chat-input-sent": CustomEvent<Message>;
3439
"shiny-chat-append-message": CustomEvent<Message>;
3540
"shiny-chat-append-message-chunk": CustomEvent<Message>;
3641
"shiny-chat-clear-messages": CustomEvent;
37-
"shiny-chat-set-user-input": CustomEvent<string>;
42+
"shiny-chat-update-user-input": CustomEvent<UpdateUserInput>;
3843
"shiny-chat-remove-loading-message": CustomEvent;
3944
"shiny-chat-request-scroll": CustomEvent<requestScrollEvent>;
4045
}
@@ -270,7 +275,7 @@ class ChatContainer extends LightElement {
270275
this.#onAppendChunk
271276
);
272277
this.addEventListener("shiny-chat-clear-messages", this.#onClear);
273-
this.addEventListener("shiny-chat-set-user-input", this.#onSetUserInput);
278+
this.addEventListener("shiny-chat-update-user-input", this.#onUpdateUserInput);
274279
this.addEventListener(
275280
"shiny-chat-remove-loading-message",
276281
this.#onRemoveLoadingMessage
@@ -291,7 +296,10 @@ class ChatContainer extends LightElement {
291296
this.#onAppendChunk
292297
);
293298
this.removeEventListener("shiny-chat-clear-messages", this.#onClear);
294-
this.removeEventListener("shiny-chat-set-user-input", this.#onSetUserInput);
299+
this.removeEventListener(
300+
"shiny-chat-update-user-input",
301+
this.#onUpdateUserInput
302+
);
295303
this.removeEventListener(
296304
"shiny-chat-remove-loading-message",
297305
this.#onRemoveLoadingMessage
@@ -373,8 +381,14 @@ class ChatContainer extends LightElement {
373381
this.messages.innerHTML = "";
374382
}
375383

376-
#onSetUserInput(event: CustomEvent<string>): void {
377-
this.input.setInputValue(event.detail);
384+
#onUpdateUserInput(event: CustomEvent<UpdateUserInput>): void {
385+
const { value, placeholder } = event.detail;
386+
if (value !== undefined) {
387+
this.input.setInputValue(value);
388+
}
389+
if (placeholder !== undefined) {
390+
this.input.placeholder = placeholder;
391+
}
378392
}
379393

380394
#onRemoveLoadingMessage(): void {

pyproject.toml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
[build-system]
2+
requires = ["setuptools>=60", "wheel", "setuptools_scm>=8.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools]
6+
packages = {find = {include = ["shiny", "shiny.*"]}}
7+
8+
[tool.setuptools_scm]
9+
write_to = "shiny/_version.py"
10+
local_scheme = "no-local-version"
11+
12+
[project]
13+
name = "shiny"
14+
dynamic = ["version"]
15+
authors = [
16+
{name = "Winston Chang", email = "winston@posit.co"},
17+
]
18+
description = "A web development framework for Python."
19+
readme = "README.md"
20+
requires-python = ">=3.8"
21+
license = {text = "MIT"}
22+
classifiers = [
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"License :: OSI Approved :: MIT License",
26+
"Natural Language :: English",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
]
33+
dependencies = [
34+
"typing-extensions>=4.10.0",
35+
"uvicorn>=0.16.0;platform_system!='Emscripten'",
36+
"starlette",
37+
"websockets>=10.0",
38+
"python-multipart",
39+
"htmltools>=0.5.2",
40+
"click>=8.1.4;platform_system!='Emscripten'",
41+
"markdown-it-py>=1.1.0",
42+
"mdit-py-plugins>=0.3.0",
43+
"linkify-it-py>=1.0",
44+
"appdirs>=1.4.4",
45+
"asgiref>=3.5.2",
46+
"packaging>=20.9",
47+
"watchfiles>=0.18.0;platform_system!='Emscripten'",
48+
"questionary>=2.0.0;platform_system!='Emscripten'",
49+
"prompt-toolkit;platform_system!='Emscripten'",
50+
"python-multipart>=0.0.7;platform_system!='Emscripten'",
51+
"setuptools;python_version>='3.12'",
52+
]
53+
54+
[project.optional-dependencies]
55+
theme = ["libsass>=0.23.0"]
56+
test = [
57+
"pytest>=6.2.4",
58+
"pytest-asyncio>=0.17.2",
59+
"pytest-playwright>=0.3.0",
60+
"playwright>=1.43.0",
61+
"pytest-xdist",
62+
"pytest-timeout",
63+
"pytest-rerunfailures",
64+
"pytest-cov",
65+
"coverage",
66+
"syrupy>=4.7.1",
67+
"psutil",
68+
"astropy",
69+
"suntime",
70+
"timezonefinder",
71+
"ipyleaflet",
72+
"shinywidgets",
73+
"seaborn",
74+
"plotnine",
75+
"plotly",
76+
"duckdb",
77+
"holoviews",
78+
"bokeh",
79+
"xarray",
80+
"geopandas",
81+
"geodatasets",
82+
"missingno",
83+
"rsconnect-python",
84+
"scikit-learn",
85+
"folium",
86+
"palmerpenguins",
87+
"faicons",
88+
"ridgeplot",
89+
"great_tables",
90+
]
91+
dev = [
92+
"black>=24.0",
93+
"flake8>=6.0.0",
94+
"flake8-bugbear>=23.2.13",
95+
"Flake8-pyproject>=1.2.3",
96+
"isort>=5.10.1",
97+
"libsass>=0.23.0",
98+
"pyright==1.1.369",
99+
"pre-commit>=2.15.0",
100+
"wheel",
101+
"matplotlib",
102+
"pandas",
103+
"pandas-stubs",
104+
"polars",
105+
"numpy",
106+
"shinyswatch>=0.7.0",
107+
"python-dotenv",
108+
"anthropic",
109+
"google-generativeai;python_version>='3.9'",
110+
"langchain_core",
111+
"openai",
112+
"ollama",
113+
"tokenizers",
114+
"aiohttp",
115+
"beautifulsoup4",
116+
]
117+
doc = [
118+
"jupyter",
119+
"jupyter_client < 8.0.0",
120+
"tabulate",
121+
"shinylive",
122+
"pydantic>=2.7.4",
123+
"quartodoc==0.7.5",
124+
"griffe<1.0.0",
125+
]
126+
127+
[project.urls]
128+
Homepage = "https://github.com/posit-dev/py-shiny"
129+
Documentation = "https://shiny.posit.co/py/"
130+
Repository = "https://github.com/posit-dev/py-shiny"
131+
"Bug Tracker" = "https://github.com/posit-dev/py-shiny/issues"
132+
133+
[project.scripts]
134+
shiny = "shiny._main:main"
135+
136+
[project.entry-points.pytest11]
137+
shiny-test = "shiny.pytest._pytest"
138+
139+
[tool.pytest.ini_options]
140+
testpaths = ["tests"]
141+
142+
[tool.flake8]
143+
extend-exclude = ["docs", ".venv", "venv", "typings", "build", "_dev"]
144+
ignore = ["E302", "E501", "F403", "F405", "W503", "E203", "E701", "E704"]
145+
146+
[tool.isort]
147+
profile = "black"
148+
skip = ["__init__.py", "typings/", "_dev/", ".venv", "venv", ".tox", "build"]

0 commit comments

Comments
 (0)