Skip to content

Commit

Permalink
Revert "Remove apps (#96)"
Browse files Browse the repository at this point in the history
This reverts commit 1ba1dc9.
  • Loading branch information
wch committed Jan 25, 2024
1 parent 7ff117b commit 6897181
Show file tree
Hide file tree
Showing 11 changed files with 619 additions and 422 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/venv/
**/.venv/
**/.DS_Store
/node_modules/
/packages/*.whl
/dist/
Expand Down
50 changes: 38 additions & 12 deletions examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"category": "Featured",
"apps": [
"cpuinfo",
"orbit",
"regularization",
"wordle",
"plotly",
"ipyleaflet"
"ipyleaflet",
"camera"
]
},
{
Expand All @@ -24,11 +27,45 @@
"file_download",
"insert_ui",
"input_update",
"modules",
"extra_packages",
"static_content",
"fetch",
"ipywidgets"
]
},
{
"category": "Inputs",
"apps": [
"input_text",
"input_numeric",
"input_slider",
"input_checkbox",
"input_switch",
"input_checkbox_group",
"input_select",
"input_radio",
"input_text_area",
"input_date",
"input_date_range",
"input_password"
]
},
{
"category": "Outputs",
"apps": [
"output_text",
"output_text_verbatim",
"output_ui",
"output_plot",
"output_table",
"output_data_frame_grid"
]
},
{
"category": "Layout",
"apps": ["shinyswatch", "layout_sidebar", "layout_two_column"]
},
{
"category": "Reactivity",
"apps": [
Expand All @@ -38,17 +75,6 @@
"reactive_value"
]
},
{
"category": "Shiny Core",
"apps": [
"modules",
"plot_interact_basic",
"plot_interact_exclude",
"orbit",
"wordle",
"static_content"
]
},
{
"category": "Interactive plots",
"apps": [
Expand Down
30 changes: 21 additions & 9 deletions examples/python/app_with_plot/app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import matplotlib.pyplot as plt
import numpy as np
from shiny import render
from shiny.express import ui, input
from shiny import App, render, ui

with ui.sidebar():
ui.input_slider("n", "N", 0, 100, 20)
app_ui = ui.page_fluid(
ui.layout_sidebar(
ui.panel_sidebar(
ui.input_slider("n", "N", 0, 100, 20),
),
ui.panel_main(
ui.output_plot("histogram"),
),
),
)


@render.plot(alt="A histogram")
def histogram():
np.random.seed(19680801)
x = 100 + 15 * np.random.randn(437)
plt.hist(x, input.n(), density=True)
def server(input, output, session):
@output
@render.plot(alt="A histogram")
def histogram():
np.random.seed(19680801)
x = 100 + 15 * np.random.randn(437)
plt.hist(x, input.n(), density=True)


app = App(app_ui, server, debug=True)
18 changes: 12 additions & 6 deletions examples/python/basic_app/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from shiny import render
from shiny.express import ui, input
from shiny import App, render, ui

app_ui = ui.page_fluid(
ui.input_slider("n", "N", 0, 100, 20),
ui.output_text_verbatim("txt"),
)

ui.input_slider("n", "N", 0, 100, 20),

def server(input, output, session):
@output
@render.text
def txt():
return f"n*2 is {input.n() * 2}"

@render.text
def txt():
return f"n*2 is {input.n() * 2}"

app = App(app_ui, server)
Loading

0 comments on commit 6897181

Please sign in to comment.