Skip to content

pywry.assets

Built-in asset loaders for Plotly, AG Grid, CSS, icons, toasts, and modals.


Plotly Assets

pywry.assets.get_plotly_js cached

get_plotly_js() -> str

Get the bundled Plotly.js library content.

RETURNS DESCRIPTION
str

The Plotly.js source code (full bundle with templates), or empty if not bundled.

pywry.assets.get_plotly_templates_js cached

get_plotly_templates_js() -> str

Get the bundled Plotly templates (plotly_dark, plotly_white).

RETURNS DESCRIPTION
str

JavaScript that defines window.PYWRY_PLOTLY_TEMPLATES, or empty if not bundled.

pywry.assets.get_plotly_defaults_js cached

get_plotly_defaults_js() -> str

Get the PyWry Plotly defaults JavaScript.

This is the SINGLE SOURCE OF TRUTH for all Plotly chart configuration and event handling. All rendering paths (notebook, inline, window) must include this.

RETURNS DESCRIPTION
str

The Plotly defaults JavaScript content.


AG Grid Assets

pywry.assets.get_aggrid_js cached

get_aggrid_js() -> str

Get the bundled AG Grid library content.

RETURNS DESCRIPTION
str

The minified AG Grid source code, or empty string if not bundled.

pywry.assets.get_aggrid_css cached

get_aggrid_css(theme: str, mode: ThemeMode) -> str

Get the AG Grid CSS for a specific theme and mode.

PARAMETER DESCRIPTION
theme

The AG Grid theme name (quartz, alpine, balham, material).

TYPE: str

mode

The theme mode (light or dark).

TYPE: ThemeMode

RETURNS DESCRIPTION
str

The combined CSS content, or empty string if not found.

pywry.assets.get_aggrid_defaults_js cached

get_aggrid_defaults_js() -> str

Get the PyWry AG Grid defaults JavaScript.

This is the SINGLE SOURCE OF TRUTH for all AG Grid configuration. All rendering paths (notebook, inline, window) must include this.

RETURNS DESCRIPTION
str

The AG Grid defaults JavaScript content.


Core CSS & JS

pywry.assets.get_pywry_css cached

get_pywry_css() -> str

Get the PyWry CSS content.

RETURNS DESCRIPTION
str

The PyWry CSS content, or empty if not found.

pywry.assets.get_scrollbar_js cached

get_scrollbar_js() -> str

Get the custom scrollbar JavaScript content.

This provides macOS-style overlay scrollbars that work in both native windows and widget/iframe contexts.

RETURNS DESCRIPTION
str

The scrollbar JavaScript content, or empty if not found.


Toast & Modal Assets

pywry.assets.get_toast_notifications_js cached

get_toast_notifications_js() -> str

Get the PyWry Toast notification JavaScript.

This provides the PYWRY_TOAST object for showing typed toast notifications (info, success, warning, error, confirm).

RETURNS DESCRIPTION
str

The toast notifications JavaScript content.

pywry.assets.get_toast_css cached

get_toast_css() -> str

Get the PyWry Toast CSS styles.

RETURNS DESCRIPTION
str

The toast CSS content.

pywry.assets.get_modal_handlers_js cached

get_modal_handlers_js() -> str

Get the PyWry Modal handlers JavaScript.

This provides the pywry.modal object for opening, closing, and managing modal overlays.

RETURNS DESCRIPTION
str

The modal handlers JavaScript content.


Icons

pywry.assets.get_openbb_icon cached

get_openbb_icon() -> bytes

Get the bundled OpenBB icon.

RETURNS DESCRIPTION
bytes

The icon file content as bytes, or empty bytes if not found.

pywry.assets.get_openbb_icon_path

get_openbb_icon_path() -> Path | None

Get the path to the bundled OpenBB icon.

RETURNS DESCRIPTION
Path or None

The path to the icon file, or None if not found.


Cache Management

pywry.assets.clear_css_cache

clear_css_cache() -> None

Clear the cached CSS and JS content.

Call this after modifying pywry.css or scrollbar.js during development to force a reload on the next request.

pywry.assets.clear_cache

clear_cache() -> None

Clear all cached asset data.