-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from posit-conf-2024/hello-shiny-edits
Hello shiny edits
- Loading branch information
Showing
130 changed files
with
6,000 additions
and
1,557 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
.quarto/_freeze/docs/exercises/express-104-filter/index/execute-results/html.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "101 Input" | ||
--- | ||
|
||
```{python} | ||
# | echo: false | ||
# | output: asis | ||
import sys | ||
helpers_path = "../../exercises/" | ||
if helpers_path not in sys.path: | ||
sys.path.append(helpers_path) | ||
from helpers import problem_app_express, getcwd | ||
problem_app_express(getcwd()) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from shiny.express import ui | ||
|
||
ui.input_slider( | ||
id="n", | ||
label="Choose n", | ||
min=0, | ||
max=100, | ||
value=20 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shiny==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "102 Output" | ||
--- | ||
|
||
```{python} | ||
# | echo: false | ||
# | output: asis | ||
import sys | ||
helpers_path = "../../exercises/" | ||
if helpers_path not in sys.path: | ||
sys.path.append(helpers_path) | ||
from helpers import problem_app_express, getcwd | ||
problem_app_express(getcwd()) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from shiny.express import render | ||
|
||
@render.code | ||
def text(): | ||
txt="Some text to display in code format" | ||
return txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shiny==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "103 Table" | ||
--- | ||
|
||
```{python} | ||
# | echo: false | ||
# | output: asis | ||
import sys | ||
helpers_path = "../../exercises/" | ||
if helpers_path not in sys.path: | ||
sys.path.append(helpers_path) | ||
from helpers import problem_app_express, getcwd | ||
problem_app_express(getcwd()) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from shiny.express import ui | ||
|
||
ui.input_select( | ||
id="account", | ||
label="Account", | ||
choices=[ | ||
"Berge & Berge", | ||
"Fritsch & Fritsch", | ||
"Hintz & Hintz", | ||
"Mosciski and Sons", | ||
"Wolff Ltd", | ||
] | ||
) | ||
|
||
ui.input_radio_buttons( | ||
"variable", | ||
"Select a variable to plot", | ||
choices={ | ||
"prod_score": "Product Score", | ||
"training_score": "Training Score" | ||
} | ||
) |
3 changes: 1 addition & 2 deletions
3
...105-connect-filter/problem/data_import.py → docs/apps/103-table/problem/data_import.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
from pathlib import Path | ||
import pandas as pd | ||
import numpy as np | ||
|
||
file_path = Path(__file__).parent / "simulated-data.csv" | ||
|
||
df = pd.read_csv(file_path, dtype={"sub_account": str}) | ||
df["date"] = pd.to_datetime(df["date"], errors="coerce") | ||
df = df.drop(columns=["text"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import plotly.express as px | ||
from pandas import DataFrame | ||
|
||
def plot_var_distribution(df: DataFrame, var="prod_score"): | ||
fig = px.histogram(df, x=var, nbins=50, title="Model scores") | ||
fig.update_layout(xaxis_title="Score", yaxis_title="Density") | ||
return fig |
3 changes: 2 additions & 1 deletion
3
...5-connect-filter/problem/requirements.txt → docs/apps/103-table/problem/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pandas | ||
shiny==1.0.0 | ||
pandas | ||
plotly |
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
docs/exercises/express-101-hello-world/problem/app-solution.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
docs/exercises/express-108-plot/index.qmd → docs/exercises/express-101-run-app/index.qmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: "108 Add plot" | ||
title: "101 Run app" | ||
--- | ||
|
||
```{python} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Can you run a Shiny app? Navigate to the problem tab. Then click the play button to run your first app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from shiny.express import ui, render, input | ||
|
||
ui.input_text("name", "Type a name", value="world") | ||
|
||
@render.text | ||
def greeting(): | ||
return f"Hello {input.name()}!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from shiny.express import ui, render, input | ||
|
||
ui.input_text("name", "Type a name", value="world") | ||
|
||
@render.text | ||
def greeting(): | ||
return f"Hello {input.name()}!" | ||
|
||
|
File renamed without changes.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
docs/exercises/express-102-data-frame/problem/app-solution.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ises/express-105-connect-filter/index.qmd → ...exercises/express-102-ui-module/index.qmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: "105 Connect input" | ||
title: "102 The ui module" | ||
--- | ||
|
||
```{python} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add markdown syntax highlighting in combination with the `markdown()` function from the `ui` submodule to create this (not very reactive) app. |
15 changes: 15 additions & 0 deletions
15
docs/exercises/express-102-ui-module/problem/app-solution.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from shiny.express import ui | ||
|
||
ui.markdown( | ||
""" | ||
## Why Shiny for Python? | ||
Shiny lets you make pure Python web apps quickly, without worrying about: | ||
- cache | ||
- state | ||
- callbacks | ||
...or even HTML, CSS, and JavaScript. | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from shiny.express import ui | ||
|
||
""" | ||
Why Shiny for Python? | ||
Shiny lets you make pure Python web apps quickly, without worrying about: | ||
cache | ||
state | ||
callbacks | ||
...or even HTML, CSS, and JavaScript. | ||
""" |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.