# pmgfal

pydantic model generator for atproto lexicons

rust-powered lexicon parsing and python code generation.

## install

```bash
uv add pmgfal
```

## usage

```bash
# auto-detect ./lexicons or current dir
uvx pmgfal

# explicit paths
uvx pmgfal ./lexicons -o ./src/models

# filter by namespace
uvx pmgfal -p fm.plyr
```

## output

```python
# auto-generated by pmgfal - do not edit

from __future__ import annotations

from pydantic import BaseModel, Field


class FmPlyrTrack(BaseModel):
    """fm.plyr.track record"""

    uri: str
    title: str
    artist: str
    duration_ms: int | None = Field(default=None, alias="durationMs")
```

## how it works

1. parses lexicon json using [atrium-lex](https://github.com/atrium-rs/atrium) (rust)
2. generates pydantic v2 models
3. outputs standalone python - no atproto sdk dependency
