Releases: feldroy/AirField
AirField 0.5.1
AirField 0.5.1: Agent-tested documentation
AirField ships with AGENTS.md, a guide purpose-built for AI coding assistants. An agent read only this file and produced working models with every presentation type, validating that the documentation is complete enough to code from. The examples/admin_panel.py it generated is included as a realistic reference.
uv add -U AirField
What's new
-
AGENTS.md for AI coding assistants. Covers both declaration paths, every presentation type with field signatures, the parameter reference, metadata discovery, and how to combine
Annotated[]withAirField()on the same field. -
examples/admin_panel.py. Product and UserProfile models that exercise every presentation type together: context-aware visibility, priority sorting, grouped fields, and arender_table_headers()metadata consumer. Generated by an AI agent reading only AGENTS.md.
What's better
- Docs updated for 0.5.0 features. README and usage guide now cover
CsrfTokenand the choices-implies-select default.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release.
AirField 0.5.0
AirField 0.5.0: CSRF tokens and smarter defaults
AirField's typed metadata system now covers security. CSRF protection tokens, hidden inputs, signature verification, all expressible as a single CsrfToken() marker on your model field, right alongside labels, widgets, and layout hints. And choices fields just got less verbose: pass choices and AirField picks the select widget for you.
uv pip install --upgrade airfield
What's new
-
CsrfTokenpresentation type. Mark a field as a CSRF protection token and let your form renderer handle the rest: hidden input, signed value, signature verification before processing. Security metadata lives in the same typed system as everything else.csrf: str = AirField(CsrfToken())
What's better
- Choices fields default to a select widget. When you pass
choicestoAirField(), it automatically attachesWidget(kind="select"). No more spelling out what was already obvious. If you need a different widget, passwidgetortypeexplicitly and the default steps aside.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release.
AirField 0.4.0
AirField 0.4.0: All metadata is typed, all of it
Every AirField() parameter now produces a typed, frozen dataclass in field_info.metadata. primary_key, autofocus, label, widget, type, placeholder, help_text, choices are all discoverable with isinstance checks, the same way Pydantic discovers annotated-types constraints. json_schema_extra is no longer written by AirField.
pip install --upgrade AirField
What's new
-
PrimaryKeytype. Primary key fields affect presentation across every context: hidden in create forms, read-only in edit, displayed as links in tables.PrimaryKeyis now a first-classBasePresentationtype that consumers find withisinstance(m, PrimaryKey). -
Autofocustype. A renderer-agnostic focus hint. In a form it sets the autofocus attribute; in a CLI it's the first prompted field; in a TUI it receives initial widget focus.
What's changed
-
AirField no longer writes to
json_schema_extra. All presentation metadata lives infield_info.metadataas typed objects. Consumers that were readingjson_schema_extrafor label, widget, autofocus, or primary_key need to switch toisinstancechecks onfield_info.metadata. If you passjson_schema_extraexplicitly, it still flows through to Pydantic as a standard Field parameter. -
Unknown kwargs go straight to Pydantic. AirField no longer sorts kwargs into "Pydantic-known" and "extra" buckets. Everything AirField doesn't recognize passes directly to
pydantic.Field(). Pydantic v2 issues a deprecation warning for unrecognized kwargs; Pydantic v3 will raise. The_PYDANTIC_FIELD_PARAMSfrozenset that had to track every Pydantic release is gone. -
The
type="email"encoding bug is fixed. Previously,AirField(type="email")stored{"email": True}injson_schema_extra. Now it producesWidget(kind="email")in metadata, which is what consumers actually need. -
Both declaration paths converge.
AirField(type="email", label="Email")andAnnotated[str, Widget("email"), Label("Email")]produce identical metadata. Oneisinstanceloop finds everything regardless of how the field was declared.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release: the typed metadata architecture, PrimaryKey and Autofocus types, and the elimination of json_schema_extra.
AirField 0.3.1
AirField 0.3.1: Custom metadata just works
Pass any keyword argument to AirField() and it lands in json_schema_extra automatically. Known Pydantic parameters like alias and gt are forwarded to pydantic.Field; everything else becomes metadata. AirField(sortable=True, export_header="Name") does what you'd expect.
uv add AirField>=0.3.1Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release.
AirField 0.3.0
AirField 0.3.0: Define once on the model, render anywhere
Pydantic models can carry a full description of how each field should be presented. Sixteen frozen dataclasses cover labels, widgets, choices, table columns, visibility, grouping, and display formatting. Annotate your fields with Annotated[str, Label("Full name"), Widget("text")] and any form renderer, table builder, or CLI prompt generator can discover exactly what it needs.
uv add AirField>=0.3.0What's new
-
16 presentation types in
airfield.types, all frozen dataclasses inheriting fromBasePresentation:Label,Placeholder,HelpText,Widget,DisplayFormat,Choices,ColumnAlign,ColumnWidth,Filterable,Sortable,Hidden,ReadOnly,Grouped,Priority, andCompact. Consumers find them viaisinstance(m, BasePresentation)when traversing field annotations. -
AirField()accepts form and UI parameters directly:type,label,widget,choices,placeholder,help_text, andautofocus, alongside the existingprimary_key. Two ways to attach the same metadata:Annotatedtypes for full type safety, or keyword arguments for quick inline declarations.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release: the presentation type vocabulary and the expanded AirField signature.
AirField 0.2.0
AirField 0.2.0
AirField extends pydantic.Field so models can declare which field is the primary key. AirModel already depends on it for its async PostgreSQL ORM.
uv add AirFieldWhat's new
- AirField function exported as
from airfield import AirField. Accepts all the same arguments aspydantic.Fieldplusprimary_key, stored injson_schema_extra.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release.
AirField 0.1.0: Staking the claim
AirField 0.1.0: Staking the claim
AirField is a library of dataclasses describing how Pydantic model fields should be presented across UI contexts: web forms, CLI prompts, data tables, notebooks, API docs, charts.
This release reserves the PyPI package name and establishes the project scaffold. I'm just getting started here.
uv add AirFieldBuilt with Cookiecutter PyPackage after improving it quite a bit today. With every new package I create, it gets better.
Contributors
@audreyfeldroy (Audrey M. Roy Greenfeld) created AirField.