Pydantic-native form validation and rendering. Define a model, get a validated, rendered HTML form. Works with or without Air web framework.
Project description
AirForm
Pydantic-native form validation and rendering. Define a model, get a validated, rendered HTML form. Built for Air, also works standalone with FastAPI, Starlette, Litestar, or any ASGI framework.
- GitHub: https://github.com/feldroy/AirForm/
- PyPI package: https://pypi.org/project/AirForm/
- Created by: Audrey M. Roy Greenfeld | GitHub https://github.com/audreyfeldroy | PyPI https://pypi.org/user/audreyr/
- Free software: MIT License
Features
- Type-safe validated data via
AirForm[MyModel]generic parameter - Reads the full AirField metadata vocabulary: Widget, Label, Placeholder, HelpText, Choices, Autofocus, PrimaryKey, Hidden, ReadOnly
- Auto-skips PrimaryKey and Hidden("form") fields in rendered output
- HTML5 validation attributes from Pydantic constraints (minlength, maxlength, required)
- Accessible by default: aria-invalid, aria-describedby, role="alert" on errors
- Textarea, select, and checkbox rendering from type annotations and metadata
- Swappable widget for custom renderers
from_request()for async ASGI request handling (works with FastAPI Depends)
Quick start
With Air
from air import AirForm, AirModel, AirField
import air
app = air.Air()
class Contact(AirModel):
name: str
email: str = AirField(type="email", label="Email Address")
class ContactForm(AirForm[Contact]):
pass
@app.post("/contact")
async def submit(request: air.Request):
form = await ContactForm.from_request(request)
if form.is_valid:
return air.Html(air.H1(f"Thanks, {form.data.name}!"))
return air.Html(air.Raw(form.render()))
Standalone (any ASGI framework)
from pydantic import BaseModel
from airform import AirForm
class ContactModel(BaseModel):
name: str
email: str
class ContactForm(AirForm[ContactModel]):
pass
# Validate
form = ContactForm()
form.validate({"name": "Audrey", "email": "audreyfeldroy@example.com"})
if form.is_valid:
print(form.data.name) # type-safe: editor knows this is str
# Render
html = ContactForm().render()
Documentation
Documentation is built with Zensical and deployed to GitHub Pages.
- Live site: https://feldroy.github.io/AirForm/
- Preview locally:
just docs-serve(serves at http://localhost:8000) - Build:
just docs-build
API documentation is auto-generated from docstrings using mkdocstrings.
Docs deploy automatically on push to main via GitHub Actions. To enable this, go to your repo's Settings > Pages and set the source to GitHub Actions.
Installation
uv add AirForm
CLI
Preview rendered form HTML from any Pydantic model:
airform myapp.models:ContactModel
Development
See CONTRIBUTING.md for setup instructions.
Author
AirForm was created in 2026 by Audrey M. Roy Greenfeld.
Built with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.
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
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 airform-0.3.0.tar.gz.
File metadata
- Download URL: airform-0.3.0.tar.gz
- Upload date:
- Size: 68.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c64e759fd3b7be895a68e347ca1579e3e36cc12aa76fa2528332c66ddab6659
|
|
| MD5 |
8c4ee1f6047f4060cee9acad1608b1bd
|
|
| BLAKE2b-256 |
5d2a349bd9eb38a8de8ce83e5d83ba04feccc7728322a32ab92aeecbe93ca2f0
|
Provenance
The following attestation bundles were made for airform-0.3.0.tar.gz:
Publisher:
publish.yml on feldroy/AirForm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
airform-0.3.0.tar.gz -
Subject digest:
7c64e759fd3b7be895a68e347ca1579e3e36cc12aa76fa2528332c66ddab6659 - Sigstore transparency entry: 1149394893
- Sigstore integration time:
-
Permalink:
feldroy/AirForm@1764e0d4f8d161528cad4157a9a0f5ccafac6b22 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/feldroy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1764e0d4f8d161528cad4157a9a0f5ccafac6b22 -
Trigger Event:
push
-
Statement type:
File details
Details for the file airform-0.3.0-py3-none-any.whl.
File metadata
- Download URL: airform-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.9 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 |
00824b875592aae832a6283ecb82ea45af92edbcd2a71dbbd1fa4621f9b6684c
|
|
| MD5 |
05f59efece220411bf5d7d44a11433bf
|
|
| BLAKE2b-256 |
deacbce59fc699b27796ee9b5ab25b731b22f62035f59da0cdaf2d5fedcab351
|
Provenance
The following attestation bundles were made for airform-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on feldroy/AirForm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
airform-0.3.0-py3-none-any.whl -
Subject digest:
00824b875592aae832a6283ecb82ea45af92edbcd2a71dbbd1fa4621f9b6684c - Sigstore transparency entry: 1149394965
- Sigstore integration time:
-
Permalink:
feldroy/AirForm@1764e0d4f8d161528cad4157a9a0f5ccafac6b22 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/feldroy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1764e0d4f8d161528cad4157a9a0f5ccafac6b22 -
Trigger Event:
push
-
Statement type: