app-callback-workflows
Use for Plotly Dash app layouts, callbacks, pages, assets, configuration, clientside callbacks, Jupyter display, CSP, and app-level debugging.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- app-callback-workflows
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use for Plotly Dash app layouts, callbacks, pages, assets, configuration, clientside callbacks, Jupyter display, CSP, and app-level debugging.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/callbacks-and-layouts.md6.1 KB
- 参考文档references/clientside-callbacks.md3.8 KB
- 参考文档references/pages-assets-and-config.md5.4 KB
- 参考文档references/troubleshooting.md6.4 KB
- 脚本scripts/smoke_dash_app.py1.9 KB
- 脚本scripts/smoke_pages_app.py2.2 KB
03 SKILL.md 正文
Dash App and Callback Workflows
Use this sub-skill when a task is about using Dash as an application framework: creating layouts, registering callbacks, debugging ID/dependency validation, configuring pages/assets, or moving work into clientside callbacks.
Start here
- For layout and callback API details, read references/callbacks-and-layouts.md.
- For pages, URL prefixes, assets, dev tools, Jupyter, and CSP, read references/pages-assets-and-config.md.
- For browser-side callback functions, read references/clientside-callbacks.md.
- For common failures, read references/troubleshooting.md.
- Run scripts/smoke_dash_app.py for a no-browser import/layout/callback smoke check and scripts/smoke_pages_app.py for a page-registry smoke check.
Main routes
Build a basic app
Use Dash, component modules, and a component tree:
from dash import Dash, html, dcc
app = Dash(__name__)
app.layout = html.Div([
dcc.Input(id="input", value="initial"),
html.Div(id="output"),
])
Important rules:
- Layout children must be Dash components, strings, numbers,
None, or lists of those values. Raw arbitrary dicts are not valid component children. - Component IDs can be strings or dictionaries. Use dictionary IDs for pattern-matching callbacks.
- If a layout is generated dynamically, either ensure callback components exist in the initial validation layout or configure dynamic-layout behavior deliberately.
Register server-side callbacks
Use @app.callback when you have an app object and @dash.callback when you
need module-level callback registration. Core dependency classes are Output,
Input, and State.
from dash import Input, Output, State, callback, no_update
from dash.exceptions import PreventUpdate
@callback(Output("output", "children"), Input("input", "value"), State("store", "data"))
def update(value, stored):
if value is None:
raise PreventUpdate
if value == "keep":
return no_update
return f"{value}: {stored}"
Use callback troubleshooting when callbacks do not fire, fire too early, reference missing components, or form circular dependencies.
Use pattern-matching IDs
Route to dictionary IDs and wildcards when components are generated from data:
from dash import MATCH, ALL, Input, Output
@app.callback(
Output({"type": "row-output", "index": MATCH}, "children"),
Input({"type": "row-input", "index": MATCH}, "value"),
)
def per_row(value):
return value
Use MATCH for one-to-one dynamic pairs, ALL for all matching components, and
ALLSMALLER when a callback needs earlier indexed values.
Inspect callback context
Use dash.ctx or dash.callback_context inside callbacks for trigger metadata:
ctx.triggered_idgives the component ID that triggered the callback.ctx.triggered_prop_idsmaps changedid.propertystrings to IDs.ctx.args_groupingis useful with flexible callback signatures.ctx.responselets a callback set response cookies/headers in supported backends.ctx.websocketis only available for WebSocket callbacks; route those tasks to server backends and async.
Use pages, assets, and URL prefixes
Use Dash(__name__, use_pages=True) plus dash.register_page and
dash.page_container for multi-page apps. Read
pages-assets-and-config.md before
changing URL prefixes, asset loading, or Jupyter display behavior.
Move simple work clientside
Use clientside callbacks for simple browser-side transformations, browser
storage access, or UI work that should avoid a server round trip. Read
clientside-callbacks.md for namespace
registration, no_update, PreventUpdate, and set_props behavior.
Route elsewhere
- Background callbacks, async callbacks, WebSocket callbacks, backend classes, Dash hooks, and MCP: server-backends-and-async.
- Component generation, renderer internals, React resource loading, and
dash_component_api: component-renderer-development. - Running Dash tests or choosing commands: testing-and-maintenance.
Validation checklist
Before declaring an app/callback fix complete:
- The app imports
Dash,html,dcc, and dependency classes fromdash. - Every callback component ID exists in the layout, validation layout, or a deliberate dynamic-layout configuration.
- Callback return shape matches the Output grouping.
- Browser console is clean for browser-backed tasks.
- If assets, pages, or URL prefixes changed, the generated URLs use
app.get_asset_url,dash.get_relative_path, or the app's configured prefix-aware helpers.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).