Skip to main content

pydantic-takibiapi

TakibiAPI with pydantic models as the schemas, checked strictly: constraints, unknown keys and responses included.

pip install pydantic-takibiapi

Quick start

from pydantic_takibiapi import Context, Model, TakibiAPI, createRoute


class Message(Model):
    message: str


class getTakibiRoute(
    createRoute(
        {
            "method": "get",
            "path": "/takibi",
            "responses": {200: {"description": "takibi🔥", "content": {"application/json": {"schema": Message}}}},
        }
    )
):
    """Say takibi🔥."""


def getTakibiRouteHandler(c: Context[getTakibiRoute]):
    return c.json(Message(message="takibi🔥"))


app = TakibiAPI()
app.openapi(getTakibiRoute, getTakibiRouteHandler)
app.doc("/doc", {"openapi": "3.1.0", "info": {"title": "takibi API", "version": "1.0.0"}})
granian --interface rsgi myapp:app   # or: uvicorn myapp:app
curl localhost:8000/takibi           # {"message":"takibi🔥"}

Import TakibiAPI from pydantic_takibiapi; everything else works as in Takibi.

Models

Every model, nested ones included, must be strict: subclass Model (a BaseModel with strict=True, extra="forbid"). app.openapi raises TypeError otherwise. Field constraints, aliases and validators work as in pydantic.

Checks

  • Requests: c.req.valid(...) gives a checked model instance. Path, query, header and cookie text is converted ("7" → 7); JSON bodies are strict ("1" is not an int) and reject unknown keys. A failure gets 422 with pydantic's error types as code.
  • Responses: c.json(value, status) checks value against the model declared for that status. A mismatch raises ResponseValidationError and answers 500 (details in the log, not in the response).
app.onError(lambda c: c.json({"error": str(c.error)}, 500))  # replaces the 500, ResponseValidationError included

OpenAPI

Schemas come from pydantic's JSON Schema; every model is a component (Name-Input / Name-Output when reading and writing differ). "3.0.x" documents are converted from it.

Development

From the repository root: uv run pytest packages/pydantic-takibiapi. See the root README.

License

Distributed under the MIT License. See LICENSE for more information.

Metadata

Release files for pydantic-takibiapi 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-takibiapi 0.2.0
File Size Uploaded Provenance Actions
pydantic_takibiapi-0.2.0.tar.gz 7.8 kB With provenance Details for pydantic_takibiapi-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-takibiapi 0.2.0
File Interpreter ABI Platform Actions
pydantic_takibiapi-0.2.0-py3-none-any.whl Python 3 none any Details for pydantic_takibiapi-0.2.0-py3-none-any.whl

Total release size: 17.2 kB

Release files / pydantic_takibiapi-0.2.0.tar.gz

Download URL pydantic_takibiapi-0.2.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
351f379483c62a0698544a57fce51e1460b3011ad031995b7df2915f6efb27a2
BLAKE2b-256 checksum
How to use checksums
f00220e85b10106f34ed41a1b06d88e26b59667f3f4785f4d5a7db2cab7326b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / pydantic_takibiapi-0.2.0-py3-none-any.whl

Download URL pydantic_takibiapi-0.2.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f841133ad3327d898cbc686bc760117931a703c8fecca53838870afdebbf25b7
BLAKE2b-256 checksum
How to use checksums
aa9b734c3d49dee6aa3bc5ed02d6c9d0762d8b603dccba5ab82f6c703bd7c304
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for pydantic-takibiapi 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydantic_takibiapi-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page