pywry.assets¶
Built-in asset loaders for Plotly, AG Grid, CSS, icons, toasts, and modals.
Plotly Assets¶
pywry.assets.get_plotly_js
cached
¶
Get the bundled Plotly.js library content.
Returns:
| Type | Description |
|---|---|
str
|
The Plotly.js source code (full bundle with templates), or empty if not bundled. |
pywry.assets.get_plotly_templates_js
cached
¶
Get the bundled Plotly templates (plotly_dark, plotly_white).
Returns:
| Type | Description |
|---|---|
str
|
JavaScript that defines window.PYWRY_PLOTLY_TEMPLATES, or empty if not bundled. |
pywry.assets.get_plotly_defaults_js
cached
¶
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:
| Type | Description |
|---|---|
str
|
The Plotly defaults JavaScript content. |
AG Grid Assets¶
pywry.assets.get_aggrid_js
cached
¶
Get the bundled AG Grid library content.
Returns:
| Type | 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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
str
|
The AG Grid theme name (quartz, alpine, balham, material). |
required |
mode
|
ThemeMode
|
The theme mode (light or dark). |
required |
Returns:
| Type | Description |
|---|---|
str
|
The combined CSS content, or empty string if not found. |
pywry.assets.get_aggrid_defaults_js
cached
¶
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:
| Type | Description |
|---|---|
str
|
The AG Grid defaults JavaScript content. |
Core CSS & JS¶
pywry.assets.get_pywry_css
cached
¶
Get the PyWry CSS content.
Returns:
| Type | Description |
|---|---|
str
|
The PyWry CSS content, or empty if not found. |
pywry.assets.get_scrollbar_js
cached
¶
Get the custom scrollbar JavaScript content.
This provides macOS-style overlay scrollbars that work in both native windows and widget/iframe contexts.
Returns:
| Type | Description |
|---|---|
str
|
The scrollbar JavaScript content, or empty if not found. |
Toast & Modal Assets¶
pywry.assets.get_toast_notifications_js
cached
¶
Get the PyWry Toast notification JavaScript.
This provides the PYWRY_TOAST object for showing typed toast notifications (info, success, warning, error, confirm).
Returns:
| Type | Description |
|---|---|
str
|
The toast notifications JavaScript content. |
pywry.assets.get_toast_css
cached
¶
Get the PyWry Toast CSS styles.
Returns:
| Type | Description |
|---|---|
str
|
The toast CSS content. |
pywry.assets.get_modal_handlers_js
cached
¶
Get the PyWry Modal handlers JavaScript.
This provides the pywry.modal object for opening, closing, and managing modal overlays.
Returns:
| Type | Description |
|---|---|
str
|
The modal handlers JavaScript content. |
Icons¶
pywry.assets.get_openbb_icon
cached
¶
Get the bundled OpenBB icon.
Returns:
| Type | Description |
|---|---|
bytes
|
The icon file content as bytes, or empty bytes if not found. |
pywry.assets.get_openbb_icon_path
¶
Get the path to the bundled OpenBB icon.
Returns:
| Type | Description |
|---|---|
Path or None
|
The path to the icon file, or None if not found. |
Cache Management¶
pywry.assets.clear_css_cache
¶
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.