Skip to content

Commit

Permalink
Remove apps (#96)
Browse files Browse the repository at this point in the history
* Reorganize py-shiny page, remove outdated apps
  • Loading branch information
Gordon Shotwell authored Jan 12, 2024
1 parent a071e4d commit 1ba1dc9
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 619 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/venv/
**/.venv/
**/.DS_Store
/node_modules/
/packages/*.whl
/dist/
Expand Down
50 changes: 12 additions & 38 deletions examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
"category": "Featured",
"apps": [
"cpuinfo",
"orbit",
"regularization",
"wordle",
"plotly",
"ipyleaflet",
"camera"
"ipyleaflet"
]
},
{
Expand All @@ -27,45 +24,11 @@
"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 @@ -75,6 +38,17 @@
"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: 9 additions & 21 deletions examples/python/app_with_plot/app.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import matplotlib.pyplot as plt
import numpy as np
from shiny import App, render, ui
from shiny import render
from shiny.express import ui, input

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"),
),
),
)
with ui.sidebar():
ui.input_slider("n", "N", 0, 100, 20)


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)
@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)
18 changes: 6 additions & 12 deletions examples/python/basic_app/app.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
from shiny import App, render, ui
from shiny import render
from shiny.express import ui, input

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}"


app = App(app_ui, server)
@render.text
def txt():
return f"n*2 is {input.n() * 2}"
Loading

0 comments on commit 1ba1dc9

Please sign in to comment.