marimo form defined by a Pydantic model
Project description
marimo-pydantic-form
[!WARNING] This package is under active development. Features and APIs may change.
A Python package for building marimo forms from Pydantic models.
[!NOTE] Currently, UI elements must be manually assigned to each field. Automatic UI element generation is planned for future releases.
Features
- Automatically generate marimo forms from Pydantic models
- Support for nested Pydantic models
- Customizable UI elements for each field
- Type-safe form validation using Pydantic
- Easy parsing of form values back into Pydantic model instances
Installation
pip install marimo-pydantic-form
Or using uv:
uv add marimo-pydantic-form
Quick Start
import marimo as mo
from pydantic import BaseModel
from marimo_pydantic_form import PydanticFormBuilder
class Inner(BaseModel):
a: int
class Model(BaseModel):
x: float
y: Inner
# Create a form builder with custom UI elements
builder = PydanticFormBuilder(
model=Model,
ui={
"x": mo.ui.slider(0, 100, label="x"),
"y.a": mo.ui.slider(0, 100, label="y.a")
},
)
# Build the form
form = builder.build()
# Parse the form value into a Pydantic model instance
model_instance = builder.parse(form.value)
Usage
Basic Form
Create a form from a Pydantic model:
from marimo_pydantic_form import PydanticFormBuilder
builder = PydanticFormBuilder(model=YourModel)
form = builder.build()
Custom UI Elements
Assign custom marimo UI elements to specific fields using dot notation for nested fields:
builder = PydanticFormBuilder(
model=Model,
ui={
"field_name": mo.ui.text(label="Custom Label"),
"nested.field": mo.ui.slider(0, 100)
}
)
Parsing Form Values
Convert form values back to Pydantic model instances:
model_instance = builder.parse(form.value)
License
See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marimo_pydantic_form-0.1.1.tar.gz.
File metadata
- Download URL: marimo_pydantic_form-0.1.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc0b369e6b2dbe6ae29665e41022e632d1bc3daa2e65eb5b08b78324d8e24ce6
|
|
| MD5 |
415c6c6ad8e4862324ba30d31d33e5c1
|
|
| BLAKE2b-256 |
1a0a61144d7095476c01487cdafbef52f85fa8137e1c45ac1516006cb07aaa6e
|
Provenance
The following attestation bundles were made for marimo_pydantic_form-0.1.1.tar.gz:
Publisher:
release.yaml on shunichironomura/marimo-pydantic-form
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marimo_pydantic_form-0.1.1.tar.gz -
Subject digest:
bc0b369e6b2dbe6ae29665e41022e632d1bc3daa2e65eb5b08b78324d8e24ce6 - Sigstore transparency entry: 782077165
- Sigstore integration time:
-
Permalink:
shunichironomura/marimo-pydantic-form@271de395cc9b3d656653287045decccd4e7bf768 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shunichironomura
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@271de395cc9b3d656653287045decccd4e7bf768 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file marimo_pydantic_form-0.1.1-py3-none-any.whl.
File metadata
- Download URL: marimo_pydantic_form-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6e5c6d609b4ffb08a45f4f78e8d23c62cf0934facd71f3c500e915699347334
|
|
| MD5 |
4aee843a5e9ef979df2d104086c5d32b
|
|
| BLAKE2b-256 |
01ec71c33e7d3ea137c6a6a2149594f86c9c819a7f9e967956de1cc08d8e54c4
|
Provenance
The following attestation bundles were made for marimo_pydantic_form-0.1.1-py3-none-any.whl:
Publisher:
release.yaml on shunichironomura/marimo-pydantic-form
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
marimo_pydantic_form-0.1.1-py3-none-any.whl -
Subject digest:
e6e5c6d609b4ffb08a45f4f78e8d23c62cf0934facd71f3c500e915699347334 - Sigstore transparency entry: 782077168
- Sigstore integration time:
-
Permalink:
shunichironomura/marimo-pydantic-form@271de395cc9b3d656653287045decccd4e7bf768 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shunichironomura
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@271de395cc9b3d656653287045decccd4e7bf768 -
Trigger Event:
workflow_dispatch
-
Statement type: