You are looking at an HTML rendering of the generated widgets, they are lacking responsiveness due to no Python kernel being available for callbacks.

Comprehensive overview of implemented capabilitiesΒΆ

This project currently implements and combines:

  • Primitive types (string, integer, number, boolean)

  • Numeric constraints (minimum, maximum)

  • String validation via pattern

  • Enums and defaults

  • Nested object structures

  • Arrays with typed items

  • Form data read/write through .data

  • Reactive callbacks via .observe()

  • Pydantic model to schema conversion

[1]:
from ipywidgets_jsonschema import Form

capability_schema = {
    "type": "object",
    "properties": {
        "project_name": {"type": "string", "default": "demo-project"},
        "run_mode": {
            "type": "string",
            "enum": ["fast", "balanced", "accurate"],
            "default": "balanced",
        },
        "retries": {"type": "integer", "minimum": 0, "maximum": 8, "default": 2},
        "quality_score": {
            "type": "number",
            "minimum": 0.0,
            "maximum": 1.0,
            "default": 0.85,
        },
        "enabled": {"type": "boolean", "default": True},
        "tags": {
            "type": "array",
            "items": {"type": "string"},
            "default": ["baseline", "qa"],
        },
        "experiment": {
            "type": "object",
            "properties": {
                "operator": {"type": "string", "default": "student"},
                "location": {"type": "string", "default": "lab-1"},
            },
            "required": ["operator", "location"],
        },
    },
    "required": [
        "project_name",
        "run_mode",
        "retries",
        "quality_score",
        "enabled",
        "tags",
        "experiment",
    ],
}

capability_form = Form(
    capability_schema,
    use_sliders=True,
    preconstruct_array_items=2,
    show_descriptions=True,
)
capability_form.show()
[2]:
capability_form.data
[2]:
{'project_name': 'demo-project',
 'run_mode': 'balanced',
 'retries': 2,
 'quality_score': 0.85,
 'enabled': True,
 'tags': ['baseline', 'qa'],
 'experiment': {'operator': 'student', 'location': 'lab-1'}}
[3]:
def on_change(change):
    print("Changed:", change.get("name"), "->", change.get("new"))


capability_form.observe(on_change)