Skip to content
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to Shiny for Python will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [UNRELEASED]
## [Unreleased]

### Deprecations

* `ui.output_text_verbatim()` is deprecated. Please use `ui.output_text()` if you want to create an output container for some text, or `ui.output_code()` if you want to create an output container for code (monospaced text). (#2097)

### Bug fixes

Expand Down
4 changes: 2 additions & 2 deletions examples/brand/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
),
ui.card(
ui.card_header("Text Output"),
ui.output_text_verbatim("out_text1"),
ui.output_code("out_text1"),
),
),
),
Expand Down Expand Up @@ -279,7 +279,7 @@ def plot1():
spine.set_alpha(0.25)
return fig

@render.text
@render.code
def out_text1():
return "\n".join(
["def example_function():", ' return "Function output text"']
Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/ClientData/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
to reactively read the client data values from the browser.
"""
),
ui.output_text_verbatim("clientdatatext"),
ui.output_code("clientdatatext"),
ui.output_plot("myplot"),
)

Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/Renderer/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
ui.h1("Capitalization renderer"),
ui.input_text("caption", "Caption:", "Data summary"),
"@render_upper: ",
ui.output_text_verbatim("upper", placeholder=True),
ui.output_code("upper", placeholder=True),
"@render_upper(): ",
ui.output_text_verbatim("upper_with_paren", placeholder=True),
ui.output_code("upper_with_paren", placeholder=True),
"@render_capitalize: ",
ui.output_text_verbatim("cap_upper", placeholder=True),
ui.output_code("cap_upper", placeholder=True),
"@render_capitalize(to='lower'): ",
ui.output_text_verbatim("cap_lower", placeholder=True),
ui.output_code("cap_lower", placeholder=True),
)


Expand Down
6 changes: 3 additions & 3 deletions shiny/api-examples/Renderer/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Literal, Optional

from shiny.render.renderer import Renderer, ValueFn
from shiny.ui import output_text_verbatim
from shiny.ui import output_code


class render_capitalize(Renderer[str]):
Expand All @@ -28,7 +28,7 @@ def auto_output_ui(self):
"""
Express UI for the renderer
"""
return output_text_verbatim(self.output_id, placeholder=True)
return output_code(self.output_id, placeholder=True)

def __init__(
self,
Expand Down Expand Up @@ -94,7 +94,7 @@ def auto_output_ui(self):
"""
Express UI for the renderer
"""
return output_text_verbatim(self.output_id, placeholder=True)
return output_code(self.output_id, placeholder=True)

async def transform(self, value: str) -> str:
"""
Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/accordion/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ def make_items():
ui.markdown("#### Accordion: (`multiple=False`)"),
# Provide an id to create a shiny input binding
ui.accordion(*make_items(), id="acc_single", multiple=False),
ui.output_text_verbatim("acc_single_val", placeholder=True),
ui.output_code("acc_single_val", placeholder=True),
ui.tags.br(),
ui.markdown("#### Accordion: (`multiple=True`)"),
ui.accordion(*make_items(), id="acc_multiple"),
ui.output_text_verbatim("acc_multiple_val", placeholder=True),
ui.output_code("acc_multiple_val", placeholder=True),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def acc_single_val():
return "input.acc_single(): " + str(input.acc_single())

@render.text
@render.code
def acc_multiple_val():
return "input.acc_multiple(): " + str(input.acc_multiple())

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/accordion_panel/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Provide an id to create a shiny input binding
ui.accordion(*items, id="acc"),
ui.h4("Accordion:"),
ui.output_text_verbatim("acc_val", placeholder=True),
ui.output_code("acc_val", placeholder=True),
)


Expand All @@ -18,7 +18,7 @@ def server(input: Inputs, output: Outputs, session: Session):
def _():
print(input.acc())

@render.text
@render.code
def acc_val():
return "input.acc(): " + str(input.acc())

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/calc/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ui.input_action_button("first", "Invalidate first (slow) computation"),
ui.input_action_button("second", "Invalidate second (fast) computation"),
),
ui.output_text_verbatim("result"),
ui.output_code("result"),
)
)

Expand All @@ -30,7 +30,7 @@ def second():
input.second()
return random.randint(1, 1000)

@render.text
@render.code
def result():
return first() + second()

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/input_numeric/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

app_ui = ui.page_fluid(
ui.input_numeric("obs", "Observations:", 10, min=1, max=100),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def value():
return input.obs()

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/input_password/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
app_ui = ui.page_fluid(
ui.input_password("password", "Password:"),
ui.input_action_button("go", "Go"),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
@reactive.event(input.go)
def value():
return input.password()
Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/input_text/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

app_ui = ui.page_fluid(
ui.input_text("caption", "Caption:", "Data summary"),
ui.output_text_verbatim("value"),
ui.output_code("value"),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def value():
return input.caption()

Expand Down
8 changes: 4 additions & 4 deletions shiny/api-examples/input_text_area/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"Caption:",
"Data summary\nwith\nmultiple\nlines",
),
ui.output_text_verbatim("value_regular", placeholder=True),
ui.output_code("value_regular", placeholder=True),
ui.input_text_area(
"caption_autoresize",
ui.markdown("Caption (w/ `autoresize=True`):"),
"Data summary\nwith\nmultiple\nlines",
autoresize=True,
),
ui.output_text_verbatim("value_autoresize", placeholder=True),
ui.output_code("value_autoresize", placeholder=True),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def value_regular():
return input.caption_regular()

@render.text
@render.code
def value_autoresize():
return input.caption_autoresize()

Expand Down
12 changes: 6 additions & 6 deletions shiny/api-examples/output_text/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
ui.column(6, ui.code("ui.output_text()"), ui.output_text("text")),
ui.column(
6,
ui.code("ui.output_text_verbatim(placeholder=True)"),
ui.output_text_verbatim("verb", placeholder=True),
ui.code("ui.output_code(placeholder=True)"),
ui.output_code("verb", placeholder=True),
),
),
ui.row(
ui.column(6),
ui.column(
6,
ui.code("ui.output_text_verbatim(placeholder=False)"),
ui.output_text_verbatim("verb_no_placeholder", placeholder=False),
ui.code("ui.output_code(placeholder=False)"),
ui.output_code("verb_no_placeholder", placeholder=False),
),
),
)
Expand All @@ -26,11 +26,11 @@ def server(input: Inputs, output: Outputs, session: Session):
def text():
return input.txt()

@render.text
@render.code
def verb():
return input.txt()

@render.text
@render.code
def verb_no_placeholder():
return input.txt()

Expand Down
6 changes: 3 additions & 3 deletions shiny/api-examples/output_transformer/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def render_capitalize(
ui.h1("Capitalization renderer"),
ui.input_text("caption", "Caption:", "Data summary"),
"Renderer called with out parentheses:",
ui.output_text_verbatim("no_parens"),
ui.output_code("no_parens"),
"To upper:",
ui.output_text_verbatim("to_upper"),
ui.output_code("to_upper"),
"To lower:",
ui.output_text_verbatim("to_lower"),
ui.output_code("to_lower"),
)


Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/popover/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
id="card_popover",
),
),
ui.output_text_verbatim("plot_txt", placeholder=True),
ui.output_code("plot_txt", placeholder=True),
),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def plot_txt():
return f"<Making plot using x: {input.x()} and y: {input.y()}>"

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/sidebar/app-core-dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def sidebar_dynamic_container():
position=input.position(),
),
ui.h2("Dynamic sidebar"),
ui.output_text_verbatim("state_dynamic"),
ui.output_code("state_dynamic"),
)

@render.text
@render.code
def state_dynamic():
return f"input.sidebar_dynamic(): {input.sidebar_dynamic()}"

Expand Down
16 changes: 8 additions & 8 deletions shiny/api-examples/sidebar/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@
ui.card(
ui.layout_sidebar(
ui.sidebar("Left sidebar content", id="sidebar_left"),
ui.output_text_verbatim("state_left"),
ui.output_code("state_left"),
)
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Right sidebar content", id="sidebar_right", position="right"),
ui.output_text_verbatim("state_right"),
ui.output_code("state_right"),
),
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Closed sidebar content", id="sidebar_closed", open="closed"),
ui.output_text_verbatim("state_closed"),
ui.output_code("state_closed"),
)
),
ui.card(
ui.layout_sidebar(
ui.sidebar("Always sidebar content", id="sidebar_always", open="always"),
ui.output_text_verbatim("state_always"),
ui.output_code("state_always"),
)
),
)


def server(input: Inputs, output: Outputs, session: Session):
@render.text
@render.code
def state_left():
return f"input.sidebar_left(): {input.sidebar_left()}"

@render.text
@render.code
def state_right():
return f"input.sidebar_right(): {input.sidebar_right()}"

@render.text
@render.code
def state_closed():
return f"input.sidebar_closed(): {input.sidebar_closed()}"

@render.text
@render.code
def state_always():
return f"input.sidebar_always(): {input.sidebar_always()}"

Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/template/app-core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
app_ui = ui.page_fluid(
ui.panel_title("Hello Shiny!"),
ui.input_slider("n", "N", 0, 100, 20),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
)


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

Expand Down
2 changes: 1 addition & 1 deletion shiny/api-examples/theme/__purgecss.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=my_theme,
Expand Down
4 changes: 2 additions & 2 deletions shiny/api-examples/theme/app-core-local.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
title="Parameters",
),
ui.h2("Output"),
ui.output_text_verbatim("txt"),
ui.output_code("txt"),
ui.markdown(filler_text),
title="Theme Example",
theme=Path(__file__).parent / "css" / "shiny-theme-demo.css",
)


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

Expand Down
Loading
Loading