Skip to content

AirModel 0.2.0: Field metadata powered by AirField

Choose a tag to compare

@audreyfeldroy audreyfeldroy released this 18 Mar 16:38
· 20 commits to main since this release
v0.2.0
c54e039

AirModel reads field metadata from AirField's typed metadata objects instead of json_schema_extra. Define your fields with AirField() and both the ORM and form renderers discover what they need through the same field_info.metadata protocol.

uv add "AirModel>=0.2.0"

What's changed

  • Field() is replaced by AirField(). Import it from airmodel or airfield:

    # Before (0.1.x)
    from airmodel import Field
    id: int | None = Field(default=None, primary_key=True)
    
    # After (0.2.0)
    from airmodel import AirField
    id: int | None = AirField(default=None, primary_key=True)

    AirField is re-exported from both packages, so from airmodel import AirField works.

  • Primary key detection uses typed metadata. The ORM checks for PrimaryKey() in field_info.metadata (placed there by AirField(primary_key=True)) instead of reading json_schema_extra["primary_key"]. This is the same Annotated metadata protocol that AirField's presentation types (Label, Widget, Choices) use.

  • Requires AirField 0.4.0+, which stores all metadata as typed objects in field_info.metadata.

What's better

  • Full documentation rewrite: usage guide covers the complete query API with working examples, installation page lists the Python 3.13+ requirement, and all project URLs use the correct casing for GitHub Pages.

Contributors

@audreyfeldroy (Audrey M. Roy Greenfeld) designed and built this release: the AirField metadata integration, documentation rewrite, and URL corrections.