This skill helps you build Python-driven UIs with pytincture and dhxpyt, delivering backend services or browser-only apps.
npx playbooks add skill pytincture/pytincture-skill --skill pytincture-dhxpyt
Build Python-driven UIs with dhxpyt and run them either as full pytincture
services or as static browser-only pages. Targets pytincture 1.0.0rc5 and
dhxpyt 0.9.18 (the release pytincture 1.0 locks). Service mode needs Python
3.13 or 3.14.
everything on the page is visible to the user.
load_ui() only. Never override __init__ to call it —dhxpyt's LoadUICaller metaclass already calls load_ui() after
construction, so doing both builds the entire UI twice.
add_ helpers* (layout.add_grid,tabbar.add_form, layout.add_cardpanel, …) rather than constructing
widgets directly. The id you pass is an existing cell id, not a new
name. Bare CardPanel(config, root="#x") fails unless #x already exists.
SeparatorConfig exists intoolbar, sidebar and ribbon and they are different classes; importing
two unqualified silently shadows one.
MainWindow and implements load_ui().
widget.py with literal __widgetset__ / __version__, andimport widget from the entrypoint — the backend discovers the widgetset by
walking the entrypoint's imports.
@backend_for_frontend, plus @bff_policy,@bff_http_methods or @bff_stream as needed. Call them from the browser
through the awaitable name_async() companion — the plain name() form is
a blocking XHR, deprecated through 1.x.
create_app(PytinctureConfig(...)) in a separateservice.py, and run it with uvicorn. (launch_service() still works and is
the compatibility path for existing code.)
@bff_policy — without one theservice fails closed at startup. Register it by dotted path,environment={"BFF_POLICY_HOOK_PATH": "service.policy_hook"};set_bff_policy_hook() does not reach a create_app() app. Pytincture enforces declared claims
itself before the hook; roles requires all of them and needs an
identity source, so declaring roles on an export a no-login service must
serve is an unconditional 403.
/{application}, where {application} is the module filename(py_ui.py → /py_ui), not the class name.
Start from assets/examples/pytincture_app/.
Read [references/pytincture.md](references/pytincture.md) for the BFF contract,
policy-hook return values, and configuration.
MainWindow; implement load_ui().add_layout, then mount widgets into those cells with theadd_* helpers.
*Config classes or plain dicts..on_* methods (toolbar.on_click(handler)); toolbar andsidebar handlers receive (id, event).
Start from assets/examples/dhxpyt_ui/testui.py.
Read [references/dhxpyt.md](references/dhxpyt.md) for patterns and gotchas, and
[references/dhxpyt/index.md](references/dhxpyt/index.md) for the module index
and the full add_* helper table. Load a single module page such as
[references/dhxpyt/form.md](references/dhxpyt/form.md) when you need exact
config parameters — do not load them all.
assets/standalone/index.html.python -m pytincture.assets ./frontend.
<script type="text/python"> and set entrypoint inwindow.pytinctureAutoStartConfig.
#micropip-libs entry as name==version (or a wheel URL with#sha256=). Bare names are rejected.
file:// does not work.Read [references/pytincture-runtime.md](references/pytincture-runtime.md) for
configuration keys, explicit startup, and the CDN escape hatch.
| Symptom | Cause and fix |
|---|---|
| UI renders twice; duplicate toolbars/grids | __init__ calls load_ui() and so does the metaclass. Delete the __init__. |
| ComboConfig.__init__() got an unexpected keyword argument 'options' | Combo items go in data=, not options=. |
| CardPanel: target container not found | Use layout.add_cardpanel(id=<existing cell>, ...), or create the node first with attach_html. |
| Tabbar.add_cardpanel() got an unexpected keyword argument 'panel_config' | The parameter is cardpanel_config=. |
| Grid renders empty despite data | GridConfig(data=...) wants List[Dict]; json.loads() a BFF method that returns JSON text. |
| DeprecationWarning from a BFF call | Use the name_async() companion and await it from a coroutine scheduled with asyncio.ensure_future(). |
| Wrong separator style in a toolbar | sidebar.SeparatorConfig shadowed toolbar.SeparatorConfig. Alias the imports. |
| 404 for dhxpyt-99.99.99-py3-none-any.whl | The runtime fell through to devWheelVersion. Pin widgetlib: "dhxpyt==0.9.18". |
| micropip install rejected | Every entry needs an exact name==version pin or url#sha256=. |
| Service refuses to start, mentions @bff_policy | Register the hook by dotted path: PytinctureConfig(environment={"BFF_POLICY_HOOK_PATH": "service.policy_hook"}). set_bff_policy_hook() does not reach a create_app() app. |
| Data written by a BFF call is gone on the next call | BFF modules are re-executed per call, so module globals reset. Keep state in storage. |
| Policy hook raises RuntimeError | Hooks must return True/False/None, nothing else. |
| Shell renders but every BFF call answers 403 | An export declares roles while no identity source supplies role claims. Drop the requirement, or configure login (AUTH_USER_CLAIMS, an authenticator, or an IdP). |
pytincture.md — service mode, BFF contract, policy hooks, configpytincture-runtime.md — standalone runtime setup and configuration keysdhxpyt.md — dhxpyt patterns, entrypoint rule, gotchasdhxpyt/index.md — module index and the add_* helper tabledhxpyt/<module>.md — generated per-module config and widget signaturesexamples.md — index of bundled example assetsexamples/pytincture_app/ — full service-mode appexamples/dhxpyt_ui/ — minimal dhxpyt UIstandalone/index.html — browser-only page templateWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.