pytincture/pytincture-skill
Overview
This skill helps you build and modify apps that use the pytincture framework with the dhxpyt widgetset. It supports both full server-backed pytincture services (with BFF classes and policies) and browser-only standalone apps that run Python via the pytincture runtime. Use it to generate UI layouts, BFF endpoints, and embed pytincture.js for client-side Python UIs.
How this skill works
I generate MainWindow subclasses and dhxpyt layouts, create BFF data classes annotated for backend-for-frontend behavior, and wire launch points for service discovery. For standalone pages I produce an HTML template that embeds Python in <script type="text/python">, configures micropip libraries, and optionally sets window.pytinctureAutoStartConfig for custom runtimes. I follow dhxpyt helper methods (add_grid, add_form, add_cardpanel, etc.) and recommended config classes to ensure valid containers and event wiring.
When to use it
- You need a backend-delivered UI with routes, auth, or server-side BFF logic.
- You want a standalone browser app running Python via the pytincture runtime (no server).
- You must generate complex layouts using dhxpyt widgets (grid, toolbar, tabbar, sidebar).
- You are adding or refactoring BFF classes and policies for data access.
- You need a quick example scaffold to bootstrap a pytincture + dhxpyt project.
Best practices
- Prefer layout helpers (window.add_grid, add_cardpanel, add_form) instead of instantiating widgets directly.
- Annotate BFF classes with @backend_for_frontend and apply @bff_policy where needed for access control.
- Call launch_service(modules_folder='.') in service mode so discovery finds your classes.
- In standalone mode, list library names (e.g., 'dhxpyt') in #micropip-libs rather than placeholder wheel filenames.
- Use config objects (ComboConfig, GridConfig, etc.) and use 'data' for combo items instead of 'options'.
Example use cases
- Create a full pytincture service that exposes /MainWindow and backs a grid with a BFF data class.
- Build a single-page browser app that runs Python via pytincture.js and shows a toolbar + tabbar UI.
- Refactor an existing dhxpyt UI to use layout helpers and attach event handlers with .on_* methods.
- Add a BFF policy to restrict data operations and wire it into the service launch flow.
- Bootstrap a sample app from provided examples/assets and adapt widgets to your domain models.
FAQ
Use service mode for server routes, auth, or persistent backend logic; use standalone for simple browser-only UIs or demos with no server.
Why am I seeing 'CardPanel: target container not found'?
Ensure the DOM container exists before attaching, or pass a layout cell as container instead of using root with an unknown DOM id.