Open source packages - Quarto, Shiny, and more Commercial enterprise offerings

Shiny for Python 0.4.0

portrait of Winston Chang in front of windows facing trees
Written by Winston Chang
2023-06-30
Shiny hex sticker and the Python logo. Together, they read Shiny for Python.

Since we announced that Shiny for Python is generally available, we have been continuously expanding its features and capabilities. Below, we summarize the latest additions that make Shiny for Python an even more powerful tool for interactive web applications.

Introducing data grid / data table

We’ve added a new, fast-scrolling data table output.

It can easily handle tables with tens of thousands of rows and supports sorting by columns – just click on the column header to sort.

In addition to the grid-style appearance, the data can be displayed with a more traditional table-like appearance.

Data table with more traditional appearance

These tables aren’t just for displaying data – they can also allow you to select rows, and use that selection as an input, as shown here:

To use the new tables, put this in your application’s UI:

  ui.output_data_frame("mygrid")

And in your server function, use @render.data_frame and give it a function that returns a render.DataGrid(); in turn, that function as a Pandas data frame.

  @output
  @render.data_frame
  def mygrid():
    return render.DataGrid(my_df)

To get the more traditional table-like styling, return a render.DataTable() instead.

Better-looking sidebars

In addition to the new tables, we’ve also improved the look of the basic sidebar. Here’s what they used to look like:

App with old sidebar

Previously, the sidebar was only as tall as the content in the sidebar, but now they span the full height of the application. Here’s what they look like now:

App with new sidebar

You won’t have to change any code to get the new look – your existing code will just work!

Check out a live example here.

Join us at posit::conf(2023)

Join us at posit::conf(2023) and learn to build Shiny apps in Python in our hands-on workshop led by Joe Cheng, CTO of Posit. Limited spots are available, so register now!

portrait of Winston Chang in front of windows facing trees

Winston Chang

Software Engineer at Posit, PBC
Winston Chang is a software engineer at Posit and currently works on Shiny and related projects. He has also worked on several other R packages, including devtools, R6, and ggplot2. Winston is the author of the R Graphics Cookbook, published by O'Reilly Media, and has a PhD in psychology from Northwestern University.