Skip to main content

Widget Generator for JSON schema

Project description

ipywidgets-jsonschema

License: MIT GitHub Workflow Status PyPI version Conda Version Binder

A lightweight library that seamlessly combines Pydantic models, JSON Schema, and IPyWidgets to generate interactive, schema‐driven forms in Jupyter notebooks. Define your data models with Pydantic (or raw JSON Schema), and this package will produce Jupyter widgets for editing and validating.


Features

  • Automatic Widget Generation: Convert any JSON Schema or Pydantic model into a fully interactive IPyWidgets form.
  • Pydantic Integration: Leverage Pydantic’s data validation, typing, and JSON Schema generation.
  • Nested Structures: Support for nested objects, arrays, dictionaries, enums, unions, and optional fields.
  • Inline Editing UI: The PydanticEditorMixin wraps Pydantic models with an “Edit → Save/Cancel” toolbar for in‐place modifications.

Installation

ipywidgets-jsonschema can be installed with pip:

python -m pip install ipywidgets-jsonschema

Alternatively, you can get it from conda-forge:

conda install -c conda-forge ipywidgets-jsonschema

Quick Start

from pydantic import BaseModel, Field
from ipywidgets_jsonschema import Form

class Person(BaseModel):
    name: str = Field(..., description="Your full name")
    age: int = Field(..., ge=0, description="Your age in years")
    email: str = Field(None, description="Optional email")

form = Form(Person)
form.show()

# Interact with the form in Jupyter; retrieve validated data:
print(form.data)  # e.g. {"name": "Alice", "age": 30, "email": "alice@example.com"}

That’s it—your Pydantic model is now an interactive form. For more advanced examples (nested models, enums, unions, customization), see the Documentation.

License

Released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipywidgets_jsonschema-1.2.1.tar.gz (34.0 kB view details)

Uploaded Source

File details

Details for the file ipywidgets_jsonschema-1.2.1.tar.gz.

File metadata

  • Download URL: ipywidgets_jsonschema-1.2.1.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ipywidgets_jsonschema-1.2.1.tar.gz
Algorithm Hash digest
SHA256 1a7265209c3c364b7281d5ab90cd333a71d65cfc2440742439a098aa5b6715a6
MD5 ae07285d2aaa8b0948116bb4fcb5d888
BLAKE2b-256 62bf6485f5e76b7ff70f5ae193ab0ce323691434ddc95a5ba035ee9a2dee368c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipywidgets_jsonschema-1.2.1.tar.gz:

Publisher: pypi.yml on ssciwr/ipywidgets-jsonschema

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page