Skip to content

Commit f14092d

Browse files
committed
Merge branch 'main' into chore/update-changelog-prerelease
2 parents 062ab7a + 23a66cb commit f14092d

Some content is hidden

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

53 files changed

+5248
-158
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Verify test generation prompts
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/verify-test-generation-prompts.yml"
7+
- "shiny/pytest/_generate/**"
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: "prompt-test-generation-${{ github.event.pull_request.number || 'dispatch' }}"
12+
cancel-in-progress: true
13+
14+
env:
15+
PYTHON_VERSION: "3.13"
16+
ATTEMPTS: 3
17+
PYTHONUNBUFFERED: 1
18+
19+
jobs:
20+
verify-test-generation-prompts:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 30
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ env.PYTHON_VERSION }}
34+
35+
- name: Setup py-shiny
36+
id: install
37+
uses: ./.github/py-shiny/setup
38+
39+
- name: Install Test Generator Dependencies
40+
run: |
41+
make ci-install-ai-deps
42+
43+
- name: Run Evaluation and Tests 3 Times
44+
env:
45+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
46+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
47+
PYTHONUNBUFFERED: 1
48+
timeout-minutes: 25
49+
run: |
50+
make run-test-ai-evaluation
51+
52+
- name: Upload test results
53+
if: always()
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: test-results-${{ github.run_id }}
57+
path: |
58+
test-results-inspect-ai/
59+
retention-days: 7
60+
61+
- name: Process Results
62+
timeout-minutes: 2
63+
run: |
64+
# Results are already averaged by the bash script, just verify they exist
65+
if [ ! -f "test-results-inspect-ai/summary.json" ]; then
66+
echo "No averaged summary found at test-results-inspect-ai/summary.json"
67+
ls -la test-results-inspect-ai/
68+
exit 1
69+
else
70+
echo "Using averaged results from all attempts"
71+
cat test-results-inspect-ai/summary.json
72+
fi
73+
74+
- name: Check Quality Gate
75+
timeout-minutes: 2
76+
run: |
77+
if [ ! -f "test-results-inspect-ai/summary.json" ]; then
78+
echo "Summary file not found at test-results-inspect-ai/summary.json"
79+
ls -la test-results-inspect-ai/
80+
exit 1
81+
else
82+
echo "Found summary file, checking quality gate..."
83+
python tests/inspect-ai/utils/scripts/quality_gate.py test-results-inspect-ai/
84+
fi
85+
86+
- name: Prepare Comment Body
87+
if: github.event_name == 'pull_request'
88+
timeout-minutes: 1
89+
run: |
90+
python tests/inspect-ai/scripts/prepare_comment.py test-results-inspect-ai/summary.json
91+
92+
- name: Comment PR Results
93+
if: github.event_name == 'pull_request'
94+
uses: marocchino/sticky-pull-request-comment@v2
95+
with:
96+
header: inspect-ai-results
97+
path: comment_body.txt
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Verify testing documentation for changes
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/verify-testing-docs-on-change.yml"
7+
- "docs/_quartodoc-testing.yml"
8+
- "shiny/playwright/controller/**"
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
verify-testing-docs:
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'pull_request'
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup py-shiny
26+
id: install
27+
uses: ./.github/py-shiny/setup
28+
29+
- name: Install dependencies
30+
run: |
31+
make ci-install-docs
32+
33+
- name: Update testing docs and check for changes
34+
id: check-docs-changes
35+
run: |
36+
# Store the current state of the documentation file
37+
cp shiny/pytest/_generate/_data/testing-documentation.json testing-documentation-before.json
38+
39+
# Run the make command to update testing docs
40+
make update-testing-docs
41+
42+
if [[ ! -f testing-documentation-before.json || ! -f shiny/pytest/_generate/_data/testing-documentation.json ]]; then
43+
echo "One or both documentation files are missing."
44+
exit 1
45+
fi
46+
47+
# Check if the documentation file has changed
48+
if diff -q testing-documentation-before.json shiny/pytest/_generate/_data/testing-documentation.json > /dev/null 2>&1; then
49+
echo "docs_changed=true" >> $GITHUB_OUTPUT
50+
echo "The generated documentation is out of sync with the current controller changes."
51+
echo "\n\n"
52+
diff -q testing-documentation-before.json shiny/pytest/_generate/_data/testing-documentation.json || true
53+
echo "\n\n"
54+
else
55+
echo "docs_changed=false" >> $GITHUB_OUTPUT
56+
echo "Documentation file is up to date"
57+
fi
58+
59+
- name: Comment on PR about testing docs update
60+
if: steps.check-docs-changes.outputs.docs_changed == 'true'
61+
uses: marocchino/sticky-pull-request-comment@v2
62+
with:
63+
header: testing-docs-update
64+
message: |
65+
🚨 **Testing Documentation Out of Sync**
66+
67+
We detected changes in the `shiny/playwright/controller` directory that affect the testing documentation used by the `shiny add test` command.
68+
69+
**The generated documentation is out of sync with your controller changes. Please run:**
70+
71+
```bash
72+
make update-testing-docs
73+
```
74+
75+
**Then commit the updated `shiny/pytest/_generate/_data/testing-documentation.json` file.**
76+
77+
<details><summary>Additional details</summary>
78+
79+
The updated documentation file ensures that the AI test generator has access to the latest controller API documentation.
80+
81+
</details>
82+
83+
❌ **This check will fail until the documentation is updated and committed.**
84+
85+
---
86+
*This comment was automatically generated by the `verify-testing-docs-on-change.yml` workflow.*
87+
88+
- name: Remove comment when no controller changes or docs are up to date
89+
if: steps.check-docs-changes.outputs.docs_changed == 'false'
90+
uses: marocchino/sticky-pull-request-comment@v2
91+
with:
92+
header: testing-docs-update
93+
delete: true

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,10 @@ shiny_bookmarks/
123123

124124
# setuptools_scm
125125
shiny/_version.py
126+
127+
# Other
128+
tests/inspect-ai/apps/*/test_*.py
129+
test-results.xml
130+
results-inspect-ai/
131+
test-results-inspect-ai/
132+
tests/inspect-ai/scripts/test_metadata.json

CHANGELOG.md

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

88
## [1.5.0] - 2025-09-08
99

10-
### Breaking changes
11-
12-
* The `ui.Chat` and `ui.MarkdownStream` components are now imported from the new `shinychat` library. Future versions of `shinychat` will likely deprecate and remove some features from `Chat`. If you still want to use those features with the latest Shiny, we suggest pinning `shinychat` to it's initial release (v0.1.0). (#2051)
13-
1410
### New features
1511

16-
* Added `ui.insert_nav_panel()`, `ui.remove_nav_panel()`, and `ui.update_nav_panel()` to support dynamic navigation. (#90)
12+
* Added AI-powered test generator for Shiny applications. Use `shiny add test` to automatically generate comprehensive Playwright tests for your apps using AI models from Anthropic or OpenAI. (#2041)
1713

1814
* `ui.sidebar()` is now interactively resizable. (#2020)
1915

20-
* `navset_card_*()` now has a `full_screen` option to support `card()`'s existing full-screen functionality. (#1451)
16+
* `ui.sidebar()` gains a `fillable` argument to support vertical fill behavior in sidebars. (#2077)
2117

22-
* `ui.update_*()` functions now accept `ui.TagChild` (i.e., HTML) as input to the `label` and `icon` arguments. (#2020)
18+
* Added `ui.insert_nav_panel()`, `ui.remove_nav_panel()`, and `ui.update_nav_panel()` to support dynamic navigation. (#90)
2319

24-
* Added support for python 3.13. (#1711)
20+
* `navset_card_*()` now gains a `full_screen` option. (#1451)
21+
22+
* `ui.update_*()` functions now accept `ui.TagChild` (i.e., HTML) as input to the `label` and `icon` arguments. (#2020)
2523

2624
* The `.output_*()` methods of the `ClientData` class (e.g., `session.clientdata.output_height()`) can now be called without an `id` when called inside a `@render` function. (#1978)
2725

2826
* `playwright.controller.InputActionButton` gains a `expect_icon()` method. As a result, the already existing `expect_label()` no longer includes the icon. (#2020)
2927

30-
### Changes
28+
### Breaking changes
29+
30+
* The `ui.Chat` and `ui.MarkdownStream` components are now imported from the new `shinychat` library. Future versions of `shinychat` will likely deprecate and remove some features from `Chat`. If you still want to use those features with the latest Shiny, we suggest pinning `shinychat` to it's initial release (v0.1.0). (#2051)
3131

3232
* `express.ui.insert_accordion_panel()`'s function signature has changed to be more ergonomic. Now you can pass the `panel_title` and `panel_contents` directly instead of `ui.hold()`ing the `ui.accordion_panel()` context manager. (#2042)
3333

3434
### Improvements
3535

36-
* `input_date()`, `input_date_range()`, `update_date()`, and `update_date_range()` now supports `""` for values, mins, and maxes. In this case, no date will be specified on the client. (#1713) (#1689)
37-
38-
* Restricted the allowable types of the `choices` parameter of `input_select()`, `input_selectize()`, `update_select()`, and `update_selectize()` to actual set of allowable types (previously, the type was suggesting HTML-like values were supported). (#2048)
39-
4036
* Improved the styling and readability of markdown tables rendered by `ui.Chat()` and `ui.MarkdownStream()`. (#1973)
4137

42-
* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)
38+
* `input_date()`, `input_date_range()`, `update_date()`, and `update_date_range()` now support `""` for values, mins, and maxes. In this case, no date will be specified on the client. (#1713) (#1689)
4339

44-
* Added `timeout_secs` parameter to `create_app_fixture` to allow testing apps with longer startup times. (#2033)
40+
* Restricted the allowable types of the `choices` parameter of `input_select()`, `input_selectize()`, `update_select()`, and `update_selectize()` to actual set of allowable types (previously, the type was suggesting HTML-like values were supported). (#2048)
4541

4642
* Added module support for `session.clientdata` methods. This allows you to access client data values in Shiny modules without needing to namespace the keys explicitly. (#1978)
4743

48-
* Add support for selecting menu items in `Navset` controllers to improve dropdown navigation test coverage. (#2066)
44+
* Added `timeout_secs` parameter to `create_app_fixture` to allow testing apps with longer startup times. (#2033)
4945

50-
* Fixed false positive warning in `layout_columns()` about number of widths vs elements. (#1704)
46+
* Add support for selecting menu items in `Navset` controllers to improve dropdown navigation test coverage. (#2066)
5147

52-
* When errors occur in a bookmarking context, they are now reported in the Python console. (#2076)
48+
* Python 3.13 is now offically supported and tested. (#1711)
5349

5450
### Bug fixes
5551

52+
* `include_js()` and `include_css()` now work as expected in multi-user settings and also when multiple files from the same directory are included. (#2061, #2069)
53+
5654
* Fixed numerous issues related to programmatically updating selectize options. (#2053)
5755
* `update_selectize(options=...)` no longer gets ignored when `server=False` (the default).
5856
* `update_selectize(options=...)` now works as expected in a module.
5957

60-
* Fixed an issue with `update_selectize()` to properly display labels with HTML reserved characters like "&" (#1330)
58+
* Fixed an issue with `update_selectize(server=True)` not properly displaying labels with HTML reserved characters like "&" (#1330)
6159

6260
* Fixed an issue with `ui.Chat()` sometimes wanting to scroll a parent element. (#1996)
6361

64-
* Explicitly call out module usage in UI input bookmark button documentation. (#1983)
65-
66-
* Fix missing session when trying to display an error duing bookmarking. (#1984)
62+
* Fix several issues with bookmarking error reporting and documentation. (#2076, #1984, #1983)
6763

6864
* `input_date()` and `input_date_range()` once again use the client's (not the server) current date as the default `value`. (#2060)
6965

70-
* Fixed `set()` method of `InputSelectize` controller so it clears existing selections before applying new values. (#2024)
71-
72-
* `include_js()` and `include_css()` now work as expected when trying to include multiple files from the same directory. (#2069)
66+
* Fixed false positive warning in `layout_columns()` about number of widths vs elements. (#1704)
7367

74-
* `include_js()` and `include_css()` now correctly handle file permissions in multi-user settings. (#2061)
68+
* Fixed `set()` method of the `InputSelectize` test controller so it clears existing selections before applying new values. (#2024)
7569

7670
### Deprecations
7771

78-
* `ui.update_navs()` has been deprecated in favor of `ui.update_navset()`. (#2047)
72+
* `ui.update_navs()` is deprecated in favor of `ui.update_navset()`. (#2047)
7973

8074
* `ui.panel_well()` is deprecated in favor of `ui.card()`. (#2038)
8175

76+
* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)
8277

8378
## [1.4.0] - 2025-04-08
8479

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,35 @@ docs-quartodoc: FORCE
123123
@echo "-------- Making quartodoc docs --------"
124124
@cd docs && make quartodoc
125125

126+
install-repomix: install-npm FORCE ## Install repomix if not already installed
127+
@echo "-------- Installing repomix if needed --------"
128+
@if ! command -v repomix > /dev/null 2>&1; then \
129+
echo "Installing repomix..."; \
130+
npm install -g repomix; \
131+
else \
132+
echo "repomix is already installed"; \
133+
fi
134+
135+
update-testing-docs-repomix: install-repomix FORCE ## Generate repomix output for testing docs
136+
@echo "-------- Generating repomix output for testing docs --------"
137+
repomix docs/api/testing -o tests/inspect-ai/utils/scripts/repomix-output-testing.xml
138+
139+
update-testing-docs-process: FORCE ## Process repomix output to generate testing documentation JSON
140+
@echo "-------- Processing testing documentation --------"
141+
python tests/inspect-ai/utils/scripts/process_docs.py --input tests/inspect-ai/utils/scripts/repomix-output-testing.xml --output shiny/pytest/_generate/_data/testing-documentation.json
142+
@echo "-------- Cleaning up temporary files --------"
143+
rm -f tests/inspect-ai/utils/scripts/repomix-output-testing.xml
144+
145+
update-testing-docs: docs update-testing-docs-repomix update-testing-docs-process FORCE ## Update testing documentation (full pipeline)
146+
@echo "-------- Testing documentation update complete --------"
147+
148+
ci-install-ai-deps: FORCE
149+
uv pip install -e ".[dev,test,testgen]"
150+
$(MAKE) install-playwright
151+
152+
run-test-ai-evaluation: FORCE ## Run the AI evaluation script for tests
153+
@echo "-------- Running AI evaluation for tests --------"
154+
bash ./tests/inspect-ai/scripts/run-test-evaluation.sh
126155

127156
install-npm: FORCE
128157
$(if $(shell which npm), @echo -n, $(error Please install node.js and npm first. See https://nodejs.org/en/download/ for instructions.))

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ doc = [
124124
"quartodoc>=0.8.1",
125125
"griffe>=1.3.2",
126126
]
127+
testgen = [
128+
"chatlas[anthropic,openai]",
129+
"openai>=1.104.1",
130+
"anthropic>=0.62.0",
131+
"inspect-ai>=0.3.129",
132+
"pytest-timeout",
133+
]
127134

128135

129136
[project.urls]

pyrightconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
"docs",
1111
"tests/playwright/deploys/*/app.py",
1212
"shiny/templates",
13-
"tests/playwright/ai_generated_apps",
13+
"tests/playwright/ai_generated_apps/*/*/app*.py",
14+
"tests/inspect-ai/apps/*/app*.py",
15+
"shiny/pytest/_generate/_main.py",
16+
"tests/inspect-ai/scripts/evaluation.py"
1417
],
1518
"typeCheckingMode": "strict",
1619
"reportImportCycles": "none",

0 commit comments

Comments
 (0)