Skip to content

Add typed API client generation for Python #51

@PAMulligan

Description

@PAMulligan

Description

Extend `scripts/generate-client.sh` to support generating typed Python API clients from the OpenAPI spec. Currently only TypeScript clients are generated (for Aurelius frontends).

Why

Many Nerva API consumers will be Python services (data pipelines, ML backends, internal tools). A typed Python client with Pydantic models and type hints provides the same developer experience that TypeScript consumers get — type safety, autocompletion, and validation.

Acceptance Criteria

  • Add `--python` flag to `scripts/generate-client.sh`
  • Use `openapi-python-client` or similar tool to generate:
    • Pydantic models for all request/response schemas
    • Typed client class with async support
    • Proper error handling
  • Generate to `api/clients/python/` directory
  • Include a `pyproject.toml` for the generated package
  • Include a `README.md` with usage examples
  • CI passes

Example

```python
from nerva_client import NervaClient

client = NervaClient(base_url="http://localhost:3000", token="...")
users = await client.users.list(limit=20) # typed response
```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions