Dive Into PyShiny by Appsilon
Original content by Gordon Shotwell & Joe Cheng (Posit).
apps/problem-sets
folderrequirements.txt
shiny.express
!)To make a Shiny app work you need to do three things:
ui
submoduleui.input_*()
and take an id, and optionsui.output_*()
and usually just take an idui.h1()
or ui.p()
add static HTML to the appserver
functionserver
function@render.*
@render.plot(alt="A body mass plot of penguins")
def mass_plot():
df = sample_data(penguins.copy(), input.sample())
df = df.loc[df["body_mass"] < input.mass()]
return dist_plot(df)
def server(input: Inputs, output: Outputs, session: Session):
@render.text
def txt():
return f"n*2 is {input.n() * 2}"
input.n()
, not input.n
Most Shiny app development consists of variations of these three things: