Skip to content

Commit 9d02ef9

Browse files
wchjcheng5
andauthored
Remove @output from examples (#790)
Co-authored-by: Joe Cheng <[email protected]>
1 parent 42fc70f commit 9d02ef9

File tree

79 files changed

+9
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+9
-157
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
### New features
3636
* `shiny run` now takes `reload-includes` and `reload-excludes` to allow you to define which files trigger a reload (#780).
3737
* `shiny.run` now passes keyword arguments to `uvicorn.run` (#780).
38-
* The `@output` decorator is no longer required for rendering functions; `@render.xxx` decorators now register themselves automatically. You can still use `@output` explicitly if you need to set specific output options (#747).
38+
* The `@output` decorator is no longer required for rendering functions; `@render.xxx` decorators now register themselves automatically. You can still use `@output` explicitly if you need to set specific output options (#747, #790).
3939
* Added support for integration with Quarto (#746).
4040
* Added `shiny.render.renderer_components` decorator to help create new output renderers (#621).
4141
* Added `shiny.experimental.ui.popover()`, `update_popover()`, and `toggle_popover()` for easy creation (and server-side updating) of [Bootstrap popovers](https://getbootstrap.com/docs/5.3/components/popovers/). Popovers are similar to tooltips, but are more persistent, and should primarily be used with button-like UI elements (e.g. `input_action_button()` or icons) (#680).

examples/airmass/app.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ def df() -> Dict[str, pd.DataFrame]:
119119
for (altaz, obj) in zip(altaz_list, obj_names())
120120
}
121121

122-
@output
123122
@render.plot
124123
def plot():
125124
fig, [ax1, ax2] = plt.subplots(nrows=2)
@@ -160,12 +159,10 @@ def add_boundary(ax, xval):
160159

161160
return fig
162161

163-
@output
164162
@render.table
165163
def table() -> pd.DataFrame:
166164
return pd.concat(df())
167165

168-
@output
169166
@render.ui
170167
def timeinfo():
171168
start_utc, end_utc = times_utc()

examples/annotation-export/app.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def _():
6262
df = df.loc[:, ["date", "temp_c", "annotation"]]
6363
annotated_data.set(df)
6464

65-
@output
6665
@render.plot
6766
def time_series():
6867
fig, ax = plt.subplots()
@@ -76,7 +75,6 @@ def time_series():
7675
out.tick_params(axis="x", rotation=30)
7776
return out.get_figure()
7877

79-
@output
8078
@render.ui
8179
def annotator():
8280
if input.time_series_brush() is not None:
@@ -104,7 +102,6 @@ def annotator():
104102
)
105103
return out
106104

107-
@output
108105
@render.data_frame
109106
def annotations():
110107
df = annotated_data().copy()

examples/brownian/app.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,18 @@ def update_plotly_camera():
8585

8686
# DEBUGGING ====
8787

88-
@output
8988
@render.text
9089
def x_debug():
9190
return camera_eye()["x"]
9291

93-
@output
9492
@render.text
9593
def y_debug():
9694
return camera_eye()["y"]
9795

98-
@output
9996
@render.text
10097
def z_debug():
10198
return camera_eye()["z"]
10299

103-
@output
104100
@render.text
105101
def mag_debug():
106102
eye = camera_eye()

examples/cpuinfo/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def collect_cpu_samples():
145145
def reset_history():
146146
cpu_history.set(None)
147147

148-
@output
149148
@render.plot
150149
def plot():
151150
history = cpu_history_with_hold()
@@ -205,7 +204,6 @@ def plot():
205204

206205
return fig
207206

208-
@output
209207
@render.table
210208
def table():
211209
history = cpu_history_with_hold()

examples/dataframe/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def server(input: Inputs, output: Outputs, session: Session):
6161
def update_df():
6262
return df.set(sns.load_dataset(req(input.dataset())))
6363

64-
@output
6564
@render.data_frame
6665
def grid():
6766
height = 350
@@ -91,7 +90,6 @@ def handle_edit():
9190
df_copy.iat[edit["row"], edit["col"]] = edit["new_value"]
9291
df.set(df_copy)
9392

94-
@output
9593
@render.text
9694
def detail():
9795
if (

examples/duckdb/query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def query_output_ui(remove_id, qry="SELECT * from weather LIMIT 10"):
4444
def query_output_server(
4545
input, output, session, con: duckdb.DuckDBPyConnection, remove_id
4646
):
47-
@output
4847
@render.data_frame
4948
def results():
5049
# In order to avoid the query re-running with each keystroke we

examples/event/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ async def _():
6666
val = await btn_async_r()
6767
print("async @calc() event: ", str(val))
6868

69-
@output
7069
@render.ui
7170
@reactive.event(btn_async_r)
7271
async def btn_async_value():

examples/global_pyplot/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919

2020

2121
def server(input: Inputs, output: Outputs, session: Session):
22-
@output
2322
@render.plot
2423
def mpl():
2524
if input.render():
2625
plt.hist([1, 1, 2, 3, 5])
2726

28-
@output
2927
@render.plot
3028
async def mpl_bad():
3129
if input.render():

examples/headers/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010

1111
def server(input: Inputs, output: Outputs, session: Session):
12-
@output
1312
@render.text
1413
def headers():
1514
s = ""
@@ -18,7 +17,6 @@ def headers():
1817

1918
return s
2019

21-
@output
2220
@render.text
2321
def user_groups():
2422
return f"session.user: {session.user}\nsession.groups: {session.groups}"

0 commit comments

Comments
 (0)