shinyreact 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shinyreact/.agents/skills/shinyreact-build-app/SKILL.md +433 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/bookmarking.md +24 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/debugging.md +29 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/modules.md +118 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/no-build.md +35 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/shiny-outputs.md +74 -0
- shinyreact/.agents/skills/shinyreact-build-app/references/testing.md +188 -0
- shinyreact/.agents/skills/shinyreact-convert-app/SKILL.md +282 -0
- shinyreact/__init__.py +24 -0
- shinyreact/_app.py +205 -0
- shinyreact/_bookmark.py +86 -0
- shinyreact/_dep.py +93 -0
- shinyreact/_dep_discovery.py +76 -0
- shinyreact/_input_handler.py +42 -0
- shinyreact/_page.py +656 -0
- shinyreact/_protocol.py +17 -0
- shinyreact/_reactive_output.py +19 -0
- shinyreact/_send_message.py +40 -0
- shinyreact/playwright.py +204 -0
- shinyreact/www/shinyreact.css +1 -0
- shinyreact/www/shinyreact.js +49 -0
- shinyreact-0.1.0.dist-info/METADATA +114 -0
- shinyreact-0.1.0.dist-info/RECORD +25 -0
- shinyreact-0.1.0.dist-info/WHEEL +4 -0
- shinyreact-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: shinyreact
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shiny UI infrastructure for React-based component rendering
|
|
5
|
+
Project-URL: Homepage, https://posit-dev.github.io/shinyreact/py/
|
|
6
|
+
Project-URL: Documentation, https://posit-dev.github.io/shinyreact/py/
|
|
7
|
+
Project-URL: Repository, https://github.com/posit-dev/shinyreact
|
|
8
|
+
Project-URL: Changelog, https://github.com/posit-dev/shinyreact/blob/main/pkg-py/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/posit-dev/shinyreact/issues
|
|
10
|
+
Author-email: Barret Schloerke <barret@posit.co>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: dashboard,react,shiny,web
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: htmltools>=0.7.0
|
|
25
|
+
Requires-Dist: shiny>=1.8.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# shinyreact <a href="https://posit-dev.github.io/shinyreact/"><img src="https://raw.githubusercontent.com/posit-dev/shinyreact/main/pkg-py/docs/logo.svg" align="right" height="138" alt="shinyreact website" /></a>
|
|
29
|
+
|
|
30
|
+
<!-- badges: start -->
|
|
31
|
+
[](https://github.com/posit-dev/shinyreact/actions/workflows/check-py.yaml)
|
|
32
|
+
<!-- badges: end -->
|
|
33
|
+
|
|
34
|
+
shinyreact lets you write the UI of a [Shiny for Python](https://shiny.posit.co/py/) app as a [React](https://react.dev/) client you own, while the Python server contains only reactive computation. It provides the bridge between the two and ships zero UI components itself. The same [JavaScript bundle](https://posit-dev.github.io/shinyreact/js/) backs the [R package](https://posit-dev.github.io/shinyreact/r/), so one React client works against an `app.py` or an `app.R` server. The [full site](https://posit-dev.github.io/shinyreact/) covers all three.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install shinyreact
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or install the development version from GitHub:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install "git+https://github.com/posit-dev/shinyreact.git"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
`set_react_page()` discovers `www/ui.js` (and `www/ui.css`, if present) next to the app file and serves them as the page. `@reactive_output` publishes any JSON-serializable value to the client's `useShinyOutputValue()` hook:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from shiny.express import input
|
|
54
|
+
from shinyreact import reactive_output, set_react_page
|
|
55
|
+
|
|
56
|
+
set_react_page()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@reactive_output
|
|
60
|
+
def greeting():
|
|
61
|
+
return f"Hello, {input.name()}!"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
In Core mode, `page_react()` is the `ui` argument instead:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from shiny import App
|
|
68
|
+
from shinyreact import page_react, reactive_output
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def server(input, output, session):
|
|
72
|
+
@reactive_output
|
|
73
|
+
def greeting():
|
|
74
|
+
return f"Hello, {input.name()}!"
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
app = App(page_react(), server)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The matching `www/ui.js`:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const { React, ReactDOM, useShinyInput, useShinyOutputValue } = window.shinyreact;
|
|
84
|
+
const h = React.createElement;
|
|
85
|
+
|
|
86
|
+
function App() {
|
|
87
|
+
const [name, setName] = useShinyInput("name", "world");
|
|
88
|
+
const greeting = useShinyOutputValue("greeting");
|
|
89
|
+
return h(
|
|
90
|
+
"div",
|
|
91
|
+
null,
|
|
92
|
+
h("input", { value: name, onChange: (e) => setName(e.target.value) }),
|
|
93
|
+
h("p", null, greeting)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
ReactDOM.createRoot(document.body.appendChild(document.createElement("div"))).render(h(App));
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Try a complete app:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git clone https://github.com/posit-dev/shinyreact
|
|
104
|
+
shiny run shinyreact/examples/01-hello/app.py
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Learn more
|
|
108
|
+
|
|
109
|
+
- [Get started](https://posit-dev.github.io/shinyreact/) walks through the `ui.tsx` pattern: inputs, outputs, messages, and embedding traditional Shiny renderers.
|
|
110
|
+
- [TSX files and JavaScript build tools](https://posit-dev.github.io/shinyreact/articles/tsx-and-build-tools.html) explains `.tsx`, JSX, TypeScript, and what `npm run build` does.
|
|
111
|
+
- [Client hooks](https://posit-dev.github.io/shinyreact/articles/hooks.html) lists everything at `window.shinyreact`.
|
|
112
|
+
- [Testing](https://posit-dev.github.io/shinyreact/articles/testing.html) covers shiny's `local_server` pytest fixture for driving a server with no browser, and `WireTap` for wire payloads in Playwright tests.
|
|
113
|
+
- [Agent Skills](https://posit-dev.github.io/shinyreact/articles/agent-skills.html) explains the skills that ship with the package for coding agents.
|
|
114
|
+
- The [examples catalog](https://github.com/posit-dev/shinyreact/blob/main/examples/README.md) lists runnable apps from no-build to Vite + HMR.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
shinyreact/__init__.py,sha256=TNXS6Zst9LV_O-ltg70qJ80OZp2_iWZB61OUSTya3NQ,504
|
|
2
|
+
shinyreact/_app.py,sha256=SDhq9xgg561A0QmqnO415Aaxu29P3Gt2Q3pIKamBO74,9551
|
|
3
|
+
shinyreact/_bookmark.py,sha256=w2R0s3BWAXiXh4ALai2vFQUA9UGeHcLlXn5oEIrhuEg,3590
|
|
4
|
+
shinyreact/_dep.py,sha256=ESxG7YIGYx3yxF18RzUl7ta-nxwoZ2vU2RKwUXKT9Jo,3751
|
|
5
|
+
shinyreact/_dep_discovery.py,sha256=ZSv_i8MbzfXavqfRhAN8OI6lmlk9k99QfYg-p_Elsf4,3280
|
|
6
|
+
shinyreact/_input_handler.py,sha256=nGHzFCgg3y-VW3ivJ4U9gibkKRa3p-nrKb7auitI4UM,1578
|
|
7
|
+
shinyreact/_page.py,sha256=ztIF1fnF_QmD-wCQ_hkp5Kz-rn3NB0pNSY4mH25Povw,29463
|
|
8
|
+
shinyreact/_protocol.py,sha256=RToPcCXVaLU5TInGSmie2LhvDobfxb2Xsd-tcNxKYgI,794
|
|
9
|
+
shinyreact/_reactive_output.py,sha256=tUhK9uk3O7C1ulcAaeqkyJBQfRgRpwQW0e8nZLu7MxU,694
|
|
10
|
+
shinyreact/_send_message.py,sha256=TLP6CvNO7UNLFJnrGWfEkAEoSqfI8cwhCJWOlh76L-k,1203
|
|
11
|
+
shinyreact/playwright.py,sha256=Gy91Nft8Iv5_EzdUpOfMqkhheIB4oxVq5BoEUMgBce8,7989
|
|
12
|
+
shinyreact/.agents/skills/shinyreact-build-app/SKILL.md,sha256=k6NLWSvMhJbwEHOMfTFWld5vq6-85V3OP2sJ0Vslco8,19624
|
|
13
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/bookmarking.md,sha256=YASzhx-Cp6M2hfgpwmn4FqR16VATICUQWB7EtGzZQIw,1102
|
|
14
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/debugging.md,sha256=c-l9buHhu5dQYEDyzpoJ_MNPNj96RE9vLADTZacH8oM,1827
|
|
15
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/modules.md,sha256=YRycNBDfOGt6az_5OvTOj-dB9KaXurQ8TKaamfO9EoQ,4646
|
|
16
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/no-build.md,sha256=JoN66of85VIQuuP2l5yZkQj4BoMf1XCPVldP30JcwyA,1162
|
|
17
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/shiny-outputs.md,sha256=7hyqJSeV-VQqRhxJWrAmVeo2Ss1KnRO692zCExlOEQ0,3373
|
|
18
|
+
shinyreact/.agents/skills/shinyreact-build-app/references/testing.md,sha256=fxt2fhE8oX2vG-72g-43lyXjKpT9OrcATk0pFwF6Jlg,8347
|
|
19
|
+
shinyreact/.agents/skills/shinyreact-convert-app/SKILL.md,sha256=Xe6J3G7r6MGSGaxT4JTbwVbPxA3ZhEanJuUiV46aoC8,15968
|
|
20
|
+
shinyreact/www/shinyreact.css,sha256=3g_tb8PVSSt-6orzAxWoAdSktRh8c1wbgOu_mDRcWZ8,46
|
|
21
|
+
shinyreact/www/shinyreact.js,sha256=-5DlwjaUxbNVz_fouMXs3PjO1nghsORL-xa0tlzVxtk,210731
|
|
22
|
+
shinyreact-0.1.0.dist-info/METADATA,sha256=hxg3kYAwAsWmaPgkLwwbomxfd1ahO30z3bvNXi8p51Y,4715
|
|
23
|
+
shinyreact-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
24
|
+
shinyreact-0.1.0.dist-info/licenses/LICENSE,sha256=7SejslXNuxTVnigXqO6DQvLwsOIuxQQbPGeDiaGJJ28,1076
|
|
25
|
+
shinyreact-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Posit Software, PBC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|