Overview
Form Generator
It is designed to work with Pydantic and WTForms. Especially useful with SQL Admin
Usage
Simple way:
from pydantic import BaseModel, Field
from formantic import Former
class User(BaseModel):
id: int = Field(..., description="The unique identifier for the user")
name: str = Field(..., description="The name of the user")
email: str = Field(..., description="The email address of the user")
# WTForm based on Pydantic model
form = Former(User).gen_form()
form.process()
or with some additional modifications:
from pydantic import BaseModel, Field
from wtforms import StringField
from wtforms.form import BaseForm
from formantic import Former
class User(BaseModel):
id: int = Field(..., description="The unique identifier for the user")
name: str = Field(..., description="The name of the user")
email: str = Field(..., description="The email address of the user")
# Form schema for BAseModel based on Pydantic model
form_schema = Former(User).gen_form_schema()
# Some additional field
form_schema["extra_field"] = StringField(
"extra_field",
description="An additional field not in the Pydantic model",
default="Default Value"
)
form = BaseForm(form_schema)
form.process()
Then work with the form as with normal WTForms
Test
uv run pytest
Security
If you discover any security-related issues, please email email instead of using the issue tracker.
Copyright (c) 2025 Wojciech Nowicki
Metadata
Release files for formantic 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| formantic-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| formantic-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / formantic-0.1.0.tar.gz
| Download URL | formantic-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6d3125f417d6001f3839082ba56730892f7a22ffd6077c1e1f5e6615633fa4a
|
|
BLAKE2b-256 checksum How to use checksums |
f7f549644f0be2066361c8ed53bc4afb82350955ee8975931b237f0cbc8281e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 30, 2025.
Transparency logRelease files / formantic-0.1.0-py3-none-any.whl
| Download URL | formantic-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bc635002ebaee870b2e6f3a82032d557051088f5da1963e10f3c58a703f5381
|
|
BLAKE2b-256 checksum How to use checksums |
b5fa3f4e5809285a564df6b063f7a6a9af6c4e6ad48a8dc5456a7752ee46ca29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 30, 2025.
Transparency log