Miscellaneous types
types.MISSING_TYPE
types.MISSING_TYPE()
types.MISSING
types.MISSING
types.FileInfo
types.FileInfo()
Class for information about a file upload.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
import pandas as pd
from shiny import App, Inputs, Outputs, Session, reactive, render, ui
from shiny.types import FileInfo
app_ui = ui.page_fluid(
ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False),
ui.input_checkbox_group(
"stats",
"Summary Stats",
choices=["Row Count", "Column Count", "Column Names"],
selected=["Row Count", "Column Count", "Column Names"],
),
ui.output_table("summary"),
)
def server(input: Inputs, output: Outputs, session: Session):
@reactive.calc
def parsed_file():
file: list[FileInfo] | None = input.file1()
if file is None:
return pd.DataFrame()
return pd.read_csv( # pyright: ignore[reportUnknownMemberType]
file[0]["datapath"]
)
@render.table
def summary():
df = parsed_file()
if df.empty:
return pd.DataFrame()
# Get the row count, column count, and column names of the DataFrame
row_count = df.shape[0]
column_count = df.shape[1]
names = df.columns.tolist()
column_names = ", ".join(str(name) for name in names)
# Create a new DataFrame to display the information
info_df = pd.DataFrame(
{
"Row Count": [row_count],
"Column Count": [column_count],
"Column Names": [column_names],
}
)
# input.stats() is a list of strings; subset the columns based on the selected
# checkboxes
return info_df.loc[:, input.stats()]
app = App(app_ui, server)
Attributes
Name | Description |
---|---|
datapath | The path to the file on the server. |
name | The name of the file being uploaded. |
size | The size of the file in bytes. |
type | The MIME type of the file. |
types.ImgData
types.ImgData()
Return type for image.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import App, Inputs, Outputs, Session, render, ui
from shiny.types import ImgData
app_ui = ui.page_fluid(ui.output_image("image"))
def server(input: Inputs, output: Outputs, session: Session):
@render.image
def image():
from pathlib import Path
dir = Path(__file__).resolve().parent
img: ImgData = {"src": str(dir / "posit-logo.png"), "width": "100px"}
return img
app = App(app_ui, server)
## file: posit-logo.png
## type: binary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T2ORzy1o1rSKJFHuStm8ftDBB8BJucX1jcvjnAMd7JWvIEQZcwAOITAMqiybIqI4k+3FOpaHXAmXxtM6d/CIBxWOIp7WCKba7P1ZoiSXoozeSYAKTXCgH0b317Cz3+oFB8/EEoDYSvGiosfuJ932RL/MLOe1+2llTl9OTzCdXiKftvu/ZCAEYpaJJ/Up7SyOlfb3Hqb9k394rQIqtdOSMHAUDe6wdI/9Z7AEEeUSQ+/kB4cpTb+xiQ7yPCk6P4qg6721dj4WsnROMXPbXJeQqCoYXTzQCg7KCLrECr7A4AeBrmikXNsApLoo+B7gdI/xbXJgYKtyAQngBwrMelrMgvABQ/W4t999n4ioT4RY8BRYGngPllbnRotzQ6tR1S3teRFpf+3npOuwsAUt/DgcJ+gPRvGo3dXTsDC0jjo9Okxx/stLtrFtjca8/tDr/oMaAo8ZRc7TUAiJVgWh3EulpY7R3+30ufnd4PkP6tx7bM8pq5uMbbynuft/D+aXJ+4fF4BvSVc5Wlz2sCeSnn4/NIgKt83uzSN/w6Tzu8KwAxmy2h5LZwM7RKALmrHyD/yRykvFo3uXx9BvuZfN1GX9vkPOXAzOGnN7r0N+/NHXUe1TqxjsFEYzNougJNK6HP5pOeUbiiHyD9m+pTpPrypsRT4r/cUKG3CdJDHP8BmuRjpv0dH/pIEw57pVJG//abkLKkfxW/6Gme0kVwY4DpRFz1Jm/4eb/m+M/e/h8DUqoulnOQEAAAAABJRU5ErkJggg==
Attributes
Name | Description |
---|---|
alt | The alt attribute of the <img> tag. |
coordmap | TODO |
height | The height attribute of the <img> tag. |
src | The src attribute of the <img> tag. |
style | The style attribute of the <img> tag. |
width | The width attribute of the <img> tag. |
ui.Sidebar
ui.Sidebar(self, *, children, attrs, position='left', open=None, width=250, id=None, title=None, fg=None, bg=None, class_=None, max_height_mobile=None, gap=None, padding=None)
A sidebar object
Class returned from sidebar. Please do not use this class directly. Instead, supply the sidebar object to layout_sidebar.
Attributes
Name | Type | Description |
---|---|---|
children | A tuple of Tag objects that are the contents of the sidebar. | |
attrs | A dictionary of attributes that are supplied to the sidebar contents Tag container. | |
width | A valid CSS unit used for the width of the sidebar. | |
position | Where the sidebar should appear relative to the main content, one of "left" or "right" . |
|
id | ResolvedId | None |
The resolved ID. Required if wanting to reactively read (or update) the collapsible state in a Shiny app. |
title | A character title to be used as the sidebar title, which will be wrapped in a <div> element with class sidebar-title . You can also provide a custom Tag for the title element, in which case you’ll likely want to give this element class = "sidebar-title" . |
|
color | A dictionary with items "bg" for background or "fg" for foreground color. |
|
class_ | CSS classes for the sidebar container element, in addition to the fixed .sidebar class. |
|
max_height_mobile | Optional[str] | A CSS length unit (passed through as_css_unit) defining the maximum height of the horizontal sidebar when viewed on mobile devices. Only applies to always-open sidebars on mobile, where by default the sidebar container is placed below the main content container on mobile devices. |
gap | A CSS length unit defining the vertical gap (i.e., spacing) between elements provided to *args . |
|
padding | Padding within the sidebar itself. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS lengths. padding may be one to four values. * If a single value, then that value will be used for all four sides. * If two, then the first value will be used for the top and bottom, while the second value will be used for left and right. * If three values, then the first will be used for top, the second will be left and right, and the third will be bottom. * If four, then the values will be interpreted as top, right, bottom, and left respectively. |
Parameters
children:
list
[TagChild]-
A tuple of Tag objects that are the contents of the sidebar.
attrs: TagAttrs
-
A dictionary of attributes that are supplied to the sidebar contents Tag container.
width: CssUnit = 250
-
A valid CSS unit used for the width of the sidebar.
position: Literal[‘left’, ‘right’] = ‘left’
-
Where the sidebar should appear relative to the main content, one of
"left"
or"right"
. open: Optional[
SidebarOpenSpec
|SidebarOpenValue
| Literal[‘desktop’]] = None-
The initial state of the sidebar. If a string, the possible values are:
"open"
: the sidebar starts open"closed"
: the sidebar starts closed"always"
: the sidebar is always open and cannot be closed
Alternatively, you can provide a dictionary with keys
"desktop"
and"mobile"
to set different initial states for desktop and mobile. For example, when{"desktop": "open", "mobile": "closed"}
the sidebar is initialized in the open state on desktop screens or in the closed state on mobile screens. You can also choose to place an always-open sidebar above the main content on mobile devices by settingopen={"mobile": "always-above"}
. id: Optional[str] = None
-
A character string. Required if wanting to reactively read (or update) the
collapsible
state in a Shiny app. title: TagChild | str = None
-
A character title to be used as the sidebar title, which will be wrapped in a
<div>
element with classsidebar-title
. You can also provide a custom Tag for the title element, in which case you’ll likely want to give this elementclass = "sidebar-title"
. bg: Optional[str] = None
-
A background or foreground color.
class_: Optional[str] = None
-
CSS classes for the sidebar container element, in addition to the fixed
.sidebar
class. max_height_mobile: Optional[str | float] = None
-
A CSS length unit (passed through as_css_unit) defining the maximum height of the horizontal sidebar when viewed on mobile devices. Only applies to always-open sidebars on mobile, where by default the sidebar container is placed below the main content container on mobile devices.
gap: Optional[CssUnit] = None
-
A CSS length unit defining the vertical
gap
(i.e., spacing) between elements provided to*args
. padding: Optional[CssUnit |
list
[CssUnit]] = None-
Padding within the sidebar itself. This can be a numeric vector (which will be interpreted as pixels) or a character vector with valid CSS lengths.
padding
may be one to four values.- If a single value, then that value will be used for all four sides.
- If two, then the first value will be used for the top and bottom, while the second value will be used for left and right.
- If three values, then the first will be used for top, the second will be left and right, and the third will be bottom.
- If four, then the values will be interpreted as top, right, bottom, and left respectively.
Methods
Name | Description |
---|---|
open | Get or set the initial state of the sidebar. Returns a dataclass with desktop and mobile attributes. |
open
ui.Sidebar.open(value=MISSING)
Get or set the initial state of the sidebar. Returns a dataclass with desktop
and mobile
attributes.
ui.CardItem
ui.CardItem(self, item)
A wrapper around a Tag object that represents the content of a card item (e.g., card_header or card_footer).
This class is used to allow for consecutive non-card items to be bundled into a single group within card.
Parameters
item: TagChild
-
A Tag object that represents the content of a card item (e.g., card_header or card_footer).
See Also
- card for creating a card component.
- card_header for creating a header within a card.
- card_footer for creating a footer within a card.
Methods
Name | Description |
---|---|
resolve | Resolves an object with the CardItem class by returning the item provided at initialization. |
tagify | Tagify the item |
resolve
ui.CardItem.resolve()
Resolves an object with the CardItem
class by returning the item
provided at initialization.
Returns
Type | Description |
---|---|
TagChild | The item provided at initialization. |
tagify
ui.CardItem.tagify()
Tagify the item
Returns
Type | Description |
---|---|
TagList | A tagified TagList object. |
ui.AccordionPanel
ui.AccordionPanel(self, *args, data_value, icon, title, id, **kwargs)
The internal class used to represent an accordion panel.
This class is used to represent an accordion panel. It is not intended to be instantiated directly. Instead, use accordion_panel.
Parameters
*args: TagChild | TagAttrs = ()
-
Contents to appear in the accordion panel body, or tag attributes that are supplied to the returned Tag object.
data_value: str
-
A character string that uniquely identifies this panel.
icon: TagChild | None
-
A Tag which is positioned just before the
title
. title: TagChild | None
-
A title to appear in the accordion_panel’s header.
id: str | None
-
A unique id for this panel.
**kwargs: TagAttrValue = {}
-
Tag attributes to the
accordion-body
div Tag.
See Also
Methods
Name | Description |
---|---|
resolve | Resolve the AccordionPanel into a Tag. |
tagify | Resolve the AccordionPanel into a Tag. |
resolve
ui.AccordionPanel.resolve()
Resolve the AccordionPanel into a Tag.
Returns
Type | Description |
---|---|
Tag | A Tag object representing the AccordionPanel. |
tagify
ui.AccordionPanel.tagify()
Resolve the AccordionPanel into a Tag.
Returns
Type | Description |
---|---|
Tag | A tagified resolve() d value. |
reactive.Context
reactive.Context(self)
A reactive context
Methods
Name | Description |
---|---|
add_pending_flush | Tell the reactive environment that this context should be flushed the next time flushReact() called. |
execute_flush_callbacks | Execute all flush callbacks |
invalidate | Invalidate this context. It will immediately call the callbacks that have been registered with onInvalidate(). |
on_flush | Register a function to be called when this context is flushed. |
on_invalidate | Register a function to be called when this context is invalidated |
add_pending_flush
reactive.Context.add_pending_flush(priority)
Tell the reactive environment that this context should be flushed the next time flushReact() called.
execute_flush_callbacks
reactive.Context.execute_flush_callbacks()
Execute all flush callbacks
invalidate
reactive.Context.invalidate()
Invalidate this context. It will immediately call the callbacks that have been registered with onInvalidate().
on_flush
reactive.Context.on_flush(func)
Register a function to be called when this context is flushed.
on_invalidate
reactive.Context.on_invalidate(func)
Register a function to be called when this context is invalidated
ui.css.CssUnit
ui.css.CssUnit
Possible python types that can be converted into a CSS unit. Numeric values will be converted to pixels. Values equal to 0
will be converted to "0"
. Strings will be passed through as-is.
ui._input_slider.SliderValueArg
ui._input_slider.SliderValueArg
Type variable.
Usage::
T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes
Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function definitions. See class Generic for more information on generic types. Generic functions work as follows:
def repeat(x: T, n: int) -> List[T]: '''Return a list containing n references to x.''' return [x]*n
def longest(x: A, y: A) -> A: '''Return the longest of two strings.''' return x if len(x) >= len(y) else y
The latter example's signature is essentially the overloading of (str, str) -> str and (bytes, bytes) -> bytes. Also note that if the arguments are instances of some subclass of str, the return type is still plain str.
At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.
Type variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. See PEP 484 for more details. By default generic types are invariant in all type variables.
Type variables can be introspected. e.g.:
T.__name__ == 'T' T.__constraints__ == () T.__covariant__ == False T.__contravariant__ = False A.__constraints__ == (str, bytes)
Note that only type variables defined in global scope can be pickled.
ui._input_slider.SliderStepArg
ui._input_slider.SliderStepArg