Builder system for genro-bag — grammar, validation, compilation, and reactive data binding.
pip install genro-buildersfrom genro_builders import BuilderBag
from genro_builders.builders import HtmlBuilder
html = BuilderBag(builder=HtmlBuilder)
body = html.body()
body.div(id='main').p('Hello, world!')
print(html.builder._compile())- Domain-specific grammars — Define elements, validation rules, and components via decorators (
@element,@abstract,@component) - Named slots — Components can declare insertion points (
slots=['left', 'right']) for user content injection at recipe time - Built-in builders — HTML5, Markdown, XSD (schema-driven XML)
- Compilation pipeline — Expand components, resolve
^pointerbindings, render output - Reactive applications —
BagAppBaseprovides automatic re-render on data or source changes - Validation —
sub_tagscardinality,parent_tagsconstraints, typed attribute validation
Source Bag (recipe)
↓ compiler.compile()
Compiled Bag (components expanded, ^pointers resolved)
↓ compiler.render()
Output (HTML, Markdown, XML, ...)
With BagAppBase, data changes trigger automatic updates via the BindingManager subscription map.
See the docs/ directory for full documentation.
Apache License 2.0 — Copyright 2025 Softwell S.r.l.