Skip to content

Commit 3dbad0a

Browse files
committed
Add quarto example
1 parent a44952d commit 3dbad0a

File tree

8 files changed

+120
-1
lines changed

8 files changed

+120
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ dependencies = [
1010
]
1111

1212
[tool.uv.workspace]
13-
members = ["routes_example_app"]
13+
members = ["routes_example_app", "shinylive_quarto"]

shinylive_quarto/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.quarto/
2+
*.html
3+
*_files/
4+
_extensions/
5+
shinylive-sw.js
6+

shinylive_quarto/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Shinylive Quarto
2+
3+
```bash
4+
# pip install uv
5+
uv sync
6+
7+
quarto add quarto-ext/shinylive
8+
9+
quarto render basic_app.qmd
10+
11+
python -m http.server
12+
```

shinylive_quarto/_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
filters:
2+
- shinylive

shinylive_quarto/basic_app.qmd

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Shinylive in Quarto example
3+
format: html
4+
filters:
5+
- shinylive
6+
---
7+
8+
This is a Shinylive application embedded in a Quarto doc.
9+
10+
```{shinylive-python}
11+
#| standalone: true
12+
13+
from shiny import *
14+
15+
app_ui = ui.page_fluid(
16+
ui.input_slider("n", "N", 0, 100, 40),
17+
ui.output_text_verbatim("txt"),
18+
)
19+
20+
def server(input, output, session):
21+
@output
22+
@render.text
23+
def txt():
24+
return f"The value of n*2 is {input.n() * 2}"
25+
26+
app = App(app_ui, server)
27+
```

shinylive_quarto/hello.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
print("Hello from shinylive-quarto!")
3+
4+
5+
if __name__ == "__main__":
6+
main()

shinylive_quarto/pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "shinylive-quarto"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.9"
7+
dependencies = [
8+
"shinylive>=0.7.3",
9+
]

uv.lock

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)