Releases: posit-dev/py-shiny
Shiny 0.9.0
Breaking Changes
-
@render.data_framereturn values ofDataTableandDataGridhad their parameter ofrow_selection: Literal["single", "multiple"]become deprecated. Please useselection_mode="row"orselection_mode="rows"instead. (#1198) -
The
col_widthsargument ofui.layout_columns()now sets thesmbreakpoint by default, rather than themdbreakpoint. For example,col_widths=(12, 6, 6)is now equivalent to{"sm": (12, 6, 6)}rather than{"md": (12, 6, 6)}. (#1222)
New features
-
Sessionobjects now have aset_message_handler(name, fn)method that allows you to register a message handler function that will be called when a request message with the given name is received from the client (viaShiny.shinyapp.makeRequest()(JS)). (#1253) -
Experimental:
@render.data_framereturn values ofDataTableandDataGridsupporteditable=Trueto enable editing of the data table cells. (#1198) -
ui.card()andui.value_box()now take anidargument that, when provided, is used to report the full screen state of the card or value box to the server. For example, when usingui.card(id = "my_card", full_screen = TRUE)you can determine if the card is currently in full screen mode by reading the boolean value ofinput.my_card_full_screen(). (#1215, #1266) -
Added support for using
shiny.expressin Quarto Dashboards. (#1217) -
ui.value_box(),ui.layout_columns()andui.layout_column_wrap()now all havemin_heightandmax_heightarguments. These are useful in filling layouts, likeui.page_fillable(),ui.page_sidebar(fillable=True)orui.page_navbar(fillable=True). For example, you can useui.layout_columns(min_height=300, max_height=500)to ensure that a set of items (likely arranged in a row of columns) are always between 300 and 500 pixels tall. (#1223) -
Added an error console which displays errors in the browser's UI. This is enabled by default when running applications locally, and can be disabled with
shiny run --no-dev-mode. It is not enabled for applications that are deployed to a server. (#1060) -
shiny createwas updated to include some additional templates as well as an option to choose from the new templates website. (#1273, #1277, #1274) -
shiny.express.ui.page_opts()now accepts additional keyword arguments that are passed to the underlying page layout chosen byshiny.ui.page_auto(). (#1314)
Bug fixes
-
On Windows, Shiny Express app files are now read in as UTF-8. (#1203)
-
input_dark_mode()now accepts astyleargument that can be used to customize the appearance and position of the dark mode toggle switch. (#1207) -
Calling
ui.update_selectize()withchoicesandselectednow clears the current selection before updating the choices and selected value. (#1221) -
Fixed an issue that could happen with a
ui.card()orui.value_box()that is rendered dynamically via@render.uiwhen an updated card replaces a card that the user has expanded into full screen mode. Now the full screen state is reset for the new card or value box. If you want to update a card without potentially exiting the full-screen mode, update specific parts of the card usingui.output_ui()orui.output_text(). (#1221) -
ui.layout_columns()now correctly applies therow_heightsat thexsbreakpoint, if supplied. (#1222) -
ui.panel_conditional()now adds the.shiny-panel-conditionalclass to the<div>element wrapping the conditional panel contents. (#1257) -
ui.panel_conditional()no longer results in unwanted double padding when the parent container usesgapfor spacing multiple elements (e.g., when used inui.layout_columns(),ui.page_fillable(), etc). (#1266) -
Error messages now use
var(--bs-danger)instead ofvar(--bs-danger-text-emphasis)for the text color. (#1266)
Other changes
- The fill CSS used by fillable containers (i.e. when
fillable=True) now uses a CSS cascade layer namedhtmltoolsto reduce the precedence order of the fill CSS. (#1228)
Shiny 0.8.1
Breaking Changes
ui.page_sidebar()now places thetitleelement in a.navbarcontainer that matches the structure ofpage_navbar(). This ensures that the title elements ofpage_sidebar()andpage_navbar()have consistent appearance. (#1176)
Bug fixes
-
Shiny now compiles the Bootstrap 5-based stylesheets for component styles imported from https://github.com/rstudio/shiny. (#1191)
-
Fixed the CSS for
ui.output_ui()to avoid unwanted double padding when its parent container usesgapfor spacing multiple elements (e.g.,ui.layout_columns(),ui.page_fillable(), etc). (#1176)
Other changes
-
Closed #1178: Removed run-time dependency on asgiref. (#1183)
-
The uvicorn and click packages are no longer needed when running on Emscripten. (#1187)
-
We adjusted the shadows used for cards and popovers. Cards now use a slightly smaller shadow and the same shadow style is also now used by popovers. (#1176)
-
We increased the spacing between elements just slightly. This change is most noticeable in the
layout_columns()orlayout_column_wrap()component. In these and other components, you can usegapandpaddingarguments to choose your own values, or you can set the--bslib-spacer(CSS) variable. (#1176)
Shiny 0.8.0
Breaking Changes
-
Page-level sidebars used in
ui.page_sidebar()andui.page_navbar()will now default to being initially open but collapsible on desktop devices and always open on mobile devices. You can adjust this default choice by settingui.sidebar(open=). (#1129) -
ui.sidebar()is now a thin wrapper for the internalui.Sidebarclass. Theui.Sidebarclass has been updated to store the sidebar's contents and settings and to delay rendering until the sidebar HTML is actually used. Because most users callui.sidebar()instead of using the class directly, this change is not expected to affect many apps. (#1129)
New features
-
Added
ui.input_dark_mode(), a toggle switch that allows users to switch between light and dark mode. By default, whenui.input_dark_mode()is added to an app, the app's color mode follows the users's system preferences, unless the app author sets themodeargument. Whenui.input_dark_mode(id=)is set, the color mode is reported to the server, and server-side color mode updating is possible usingui.update_dark_mode(). (#1149) -
ui.sidebar(open=)now accepts a dictionary with keysdesktopandmobile, allowing you to independently control the initial state of the sidebar at desktop and mobile screen sizes. (#1129) -
Closed #984: In Shiny Express apps, if there is a
"www"subdirectory in the app's directory, Shiny will serve the files in that directory as static assets, mounted at/. (#1170) -
For Shiny Express apps, added
express.app_opts(), which allows setting application-level options, likestatic_assetsanddebug. (#1170) -
Closed #1079: For Shiny Express apps, automatically run a
globals.pyfile in the same directory as the app file, if it exists. The code inglobals.pywill be run with the session context set toNone. (#1172)
Other changes
-
@render.data_framenow properly fills its container by default. (#1126) -
We improved the accessibility of the full screen toggle button in cards created with
ui.card(full_screen=True). Full-screen cards are now also supported on mobile devices. (#1129) -
When entering and exiting full-screen card mode, Shiny now emits a client-side custom
bslib.cardevent that JavaScript-oriented users can use to react to the full screen state change. (#1129) -
The sidebar's collapse toggle now has a high
z-indexvalue to ensure it always appears above elements in the main content area ofui.layout_sidebar(). The sidebar overlay also now receives the same highz-indexon mobile layouts. (#1129) -
Updated example apps to use lower-case versions of
reactive.Calc->reactive.calc,reactive.Effect->reactive.effect, andreactive.Value->reactive.value. (#1164) -
Closed #1081: The
@expressify()function now has an optionhas_docstring. This allows the decorator to be used with functions that contain a docstring. (#1163)
Bug fixes
-
Fixed
input_task_buttonnot working in a Shiny module. (#1108) -
Fixed several issues with
page_navbar()styling. (#1124) -
Fixed
Renderer.output_idto not contain the module namespace prefix, only the output id. (#1130) -
Fixed gap-driven spacing between children in fillable
nav_panel()containers. (#1152) -
Fixed #1138: An empty value in a date or date range input would cause an error; now it is treated as
None. (#1139)
Other changes
Shiny 0.7.1
Shiny 0.7.0
Breaking Changes
New features
-
Added
shiny.ui.input_task_button()for creating buttons that launch longer-running tasks thanshiny.ui.input_action_button()was designed for. Task buttons give visual feedback that the task is running, and cannot be clicked again until the task is complete. (#907) -
Added
@extended_taskdecorator for creating long-running tasks that can be cancelled. (#907) -
Added
@render.downloadas a replacement for@session.download, which is now deprecated. (#977) -
Added
ui.output_code(), which is currently an alias forui.output_text_verbatim(). (#997) -
Added
@render.code, which is an alias for@render.text, but in Express mode, it displays the result usingui.output_code(). (#997) -
Added
App.on_shutdownmethod for registering a callback to be called when the app is shutting down. (#907) -
You can now pass options to
ui.input_selectizesee the selectize.js docs for available options. (#914, #158) -
ui.input_selectizegains theremove_buttonargument which allows you to control the visibility of the remove button.
Bug fixes
-
CLI command
shiny create... (#965)- has added a
-d/--dirflag for saving to a specific output directory - will raise an error if if will overwrite existing files
- prompt users to install
requirements.txt
- has added a
-
Fixed
js-reacttemplate build error. (#965) -
Fixed #1007: Plot interaction with plotnine provided incorrect values. (#999)
Developer features
- Output renderers should now be created with the
shiny.render.renderer.Rendererclass. This class should contain either a.transform(self, value)method (common) or a.render(self)(rare). These two methods should return something can be converted to JSON. In addition,.default_ui(self, id)should be implemented by returninghtmltools.Tag-like content for use within Shiny Express. To make your own output renderer, please inherit from theRenderer[IT]class whereITis the type (excludingNone) required to be returned from the App author. (#964)- Legacy renderers that will be removed in the near future:
shiny.render.RenderFunctionshiny.render.RenderFunctionAsyncshiny.render.transformer.OutputRenderershiny.render.transformer.OutputRendererSyncshiny.render.transformer.OutputRendererAsync
- Legacy renderers that will be removed in the near future:
Shiny 0.6.1.1
Shiny 0.6.1
New features
shiny createnow allows you to select from a list of template apps.shiny createprovides templates which help you build your own custom JavaScript components.- Closed #814: The functions
reactive.Calcandreactive.Effecthave been changed to have lowercase names:reactive.calc, andreactive.effect. The old capitalized names are now aliases to the new lowercase names, so existing code will continue to work. Similarly, the classreactive.Valuehas a new alias,reactive.value, but in this case, since the original was a class, it keeps the original capitalized name as the primary name. The examples have not been changed yet, but will be changed in a future release. (#822) - Added
ui.layout_columns()for creating responsive column-forward layouts based on Bootstrap's 12-column CSS Grid. (#856) - Added support for Shiny Express apps, which has a simpler, easier-to-use API than the existing API (Shiny Core). Please note that this API is still experimental and may change. (#767)
Bug fixes
- Fix support for
shiny.ui.accordion(multiple=)(#799).
Other changes
- Closed #492:
shiny.ui.nav()is now deprecated in favor of the more aptly namedshiny.ui.nav_panel()(#876). - Update penguins example to credit Allison Horst and drop usage of
shiny.experimental(#798). as_fillable_container()andas_fill_item()no longer mutate theTagobject that was passed in. Instead, it returns a newTagobject. Also closed #856: these functions now put thehtml-fill-containerandhtml-fill-itemCSS classes last, instead of first. (#862)App()now accepts a server function with a singleinputparameter, or a server function with parametersinput,outputandsession. Server functions with two or more than three parameters now raise an exception. (#920)
shiny 0.6.0
Breaking Changes
shiny.runonly allows positional arguments forapp,host, andport, all other arguments must be specified with keywords.
New features
-
shiny runnow takesreload-includesandreload-excludesto allow you to define which files trigger a reload (#780). -
shiny.runnow passes keyword arguments touvicorn.run(#780). -
The
@outputdecorator is no longer required for rendering functions;@render.xxxdecorators now register themselves automatically. You can still use@outputexplicitly if you need to set specific output options (#747). -
Added support for integration with Quarto (#746).
-
Added
shiny.render.renderer_componentsdecorator to help create new output renderers (#621). -
Added
shiny.experimental.ui.popover(),update_popover(), andtoggle_popover()for easy creation (and server-side updating) of Bootstrap 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). -
Added CSS classes to UI input methods (#680) .
-
Sessionobjects can now accept an asynchronous (or synchronous) function for.on_flush(fn=),.on_flushed(fn=), and.on_ended(fn=)(#686). -
App()now allowsstatic_assetsto represent multiple paths. To do this, pass in a dictionary instead of a string (#763). -
The
showcase_layoutargument ofvalue_box()now accepts one of three character values:"left center","top right","bottom". (#772) -
value_box()now supports many new themes and styles, or fully customizable themes using the newvalue_box_theme()function. To reflect the new capabilities, we've replacedtheme_colorwith a newthemeargument. The previous argument will continue work as expected, but with a deprecation warning. (#772)In addition to the Bootstrap theme names (
primary,secondary, etc.), you can now use the main Boostrap colors (purple,blue,red, etc.). You can also choose to apply the color to the background or foreground by prepending abg-ortext-prefix to the theme or color name. Finally, we've also added new gradient themes allowing you to pair any two color names asbg-gradient-{from}-{to}(e.g.,bg-gradient-purple-blue).These named color themes aren't limited to value boxes: because they're powered by small utility classes, you can use them anywhere within your bslib-powered UI.
-
Added
shiny.ui.showcase_bottom(), a newshiny.ui.value_box()layout that places the showcase below the value boxtitleandvalue, perfect for a full-bleed plot. (#772)
Bug fixes
shiny runnow respects the user providedreload-dirargument (#765).- Fixed #646: Wrap bare value box value in
<p />tags. (#668) - Fixed #676: The
render.data_frameselection feature was underdocumented and buggy (sometimes returningNoneas a row identifier if the pandas data frame's index had gaps in it). With this release, the selection is consistently a tuple of the 0-based row numbers of the selected rows--orNoneif no rows are selected. (#677) - Added tests to verify that ui input methods, ui labels, ui update (value) methods, and ui output methods work within modules (#696).
- Adjusted the
@render.plotinput type to beobjectto allow for any object (if any) to be returned (#712). - In
layout_column_wrap(), whenwidthis a CSS unit -- e.g.width = "400px"orwidth = "25%"-- andfixed_width = FALSE,layout_column_wrap()will ensure that the columns are at leastwidthwide, unless the parent container is narrower thanwidth. (#772)
Other changes
input_action_button()now defaults to having whitespace around it. (#758)layout_sidebar()now uses an<aside>element for the sidebar's container and a<header>element for the sidebar title. The classes of each element remain the same, but the semantic meaning of the elements is now better reflected in the HTML markup. (#772)layout_sidebar()no longer gives the sidebar main content area therole="main"attribute. (#772)- Improved the style and appearance of the button to enter full screen in
card()s andvalue_box()es to better adapt to Bootstrap's dark mode. (#772)
API changes
- Added
shiny.ui.navset_underline()andshiny.ui.navset_card_underline()whose navigation container is similar toshiny.ui.navset_tab()andshiny.ui.navset_card_tab()respectively, but its active/focused navigation links are styled with an underline. (#772) shiny.ui.layout_column_wrap(width, *args)was rearranged toshiny.ui.layout_column_wrap(*args, width). Now,widthwill default to200pxis no value is provided. (#772)shiny.ui.showcase_left_center()andshiny.ui.showcase_top_right()no longer take two values for thewidthargument. Instead, they now take a single value (e.g.,width = "30%") representing the width of the showcase are in the value box. Furthermore, they've both gainedwidth_full_screenarguments that determine the width of the showcase area when the value box is expanded to fill the screen. (#772)shiny.ui.panel_main()andshiny.ui.panel_sidebar()are deprecated in favor of new API forshiny.ui.layout_sidebar(). Please useshiny.ui.sidebar()to construct asidebar=and supply it toshiny.ui.layout_sidebar(sidebar, *args, **kwargs). (#788)shiny.experimental.ui.toggle_sidebar()has been renamed toshiny.ui.update_sidebar(). It'sopenvalue now only supportsboolvalues. (#788)
API relocations
shiny.ui'snavset_pill_card()andnavset_tab_card()have been renamed tonavset_card_pill()andnavset_card_tab()respectively (#492).
The following methods have been moved from shiny.experimental.ui and integrated into shiny.ui (final locations under shiny.ui are displayed) (#680):
- Sidebar - Sidebar layout or manipulation
sidebar(),page_sidebar(),update_sidebar(),layout_sidebar(),Sidebar
- Filling layout - Allow UI components to expand into the parent container and/or allow its content to expand
page_fillable(),fill.as_fillable_container(),fill.as_fill_item(),fill.remove_all_fill()output_plot(fill=),output_image(fill=),output_ui(fill=, fillable=)
- CSS units - CSS units and padding
css.as_css_unit(),css.as_css_padding(),css.CssUnit
- Tooltip - Hover-based context UI element
tooltip(),update_tooltip()
- Popover - Click-based context UI element
popover(),update_popover()
- Accordion - Vertically collapsible UI element
accordion(),accordion_panel(),insert_accordion_panel(),remove_accordion_panel(),update_accordion(),update_accordion_panel(),Accordion,AccordionPanel
- Card - A general purpose container for grouping related UI elements together
card(),card_header(),card_footer(),CardItem
- Valuebox - Opinionated container for displaying a value and title
valuebox()showcase_left_center()showcase_top_right()
- Navs - Navigation within a page
navset_bar(),navset_tab_card(),navset_pill_card()page_navbar(sidebar=, fillable=, fillable_mobile=, gap=, padding=),navset_card_tab(sidebar=),navset_card_pill(sidebar=),navset_bar(sidebar=, fillable=, gap=, padding=)
- Layout - Layout of UI elements
layout_column_wrap()
- Inputs - UI elements for user input
input_text_area(autoresize=)
If a ported method is called from shiny.experimental.ui, a deprecation warning will be displayed.
Methods still under consideration in shiny.experimental.ui:
card(wrapper=): A function (which returns a UI element) to call on unnamed arguments incard(*args)which are not alreadyshiny.ui.CardItemobjects.card_body(): A container for grouping related UI elements togethercard_image(): A general container for an image within ashiny.ui.card.card_title(): A general container for the "title" of ashiny.ui.card.
API removals
shiny.experimental.ui.FillingLayouthas been removed. (#481)shiny.experimental.ui.toggle_switch()has been made defunct. Please remove it from your code and useshiny.ui.update_switch()instead. (#772)shiny.experimental.ui.as_width_unit()has been made defunct. Please remove it from your code. (#772)shiny.experimental.ui'as_fill_carrier(),is_fill_carrier(),is_fillable_container(), andis_fill_item()have been made defunct. Remove them from your code. (#680, #788)- Support for
min_height=,max_height=, andgap=inshiny.experimental.ui.as_fillable_container()andas_fill_item()has been removed. (#481) shiny.experimental.ui.TagCallablehas been made defunct. Please use its type is equivalent tohtmltools.TagFunction. (#680)
shiny 0.5.1
shiny 0.5.0
New features
- The new fast-scrolling data table/grid feature (
ui.output_data_frame/render.data_frame) now has a filtering feature. To enable, pass the argumentfilters=Trueto therender.DataTableorrender.DataGridconstructors. (#592) shiny runnow takes a--reload-dir <DIR>argument that indicates a directory--reloadshould (recursively) monitor for changes, in addition to the app's parent directory. Can be used more than once. (#353)- The default theme has been updated to use Bootstrap 5 with custom Shiny style enhancements. (#624)
- Added experimental UI
tooltip(),update_tooltip(), andtoggle_tooltip()for easy creation (and server-side updating) of Bootstrap tooltips (a way to display additional information when focusing (or hovering over) a UI element). (#629)
Bug fixes
- Using
update_sliderto update a slider's value to adatetimeobject or other non-numeric value would result in an error. (#649)