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 anint) and reject unknown keys. A failure gets 422 with pydantic's error types ascode. - Responses:
c.json(value, status)checksvalueagainst the model declared for that status. A mismatch raisesResponseValidationErrorand 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: bazel test //pypi/pydantic-takibiapi:test. See the root README.
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for pydantic-takibiapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydantic_takibiapi-0.1.0.tar.gz | 7.7 kB | With provenance | Details for pydantic_takibiapi-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_takibiapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_takibiapi-0.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / pydantic_takibiapi-0.1.0.tar.gz
| Download URL | pydantic_takibiapi-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a1e03aa2e327a91151f0d23edfb352b16307bf8d76eb2ef06213700d04f7632
|
|
BLAKE2b-256 checksum How to use checksums |
017b9660b2d8a0f235ee1e5b98febb1beb7529287d649e9dd4d8ab7b49750b68
|
| 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 3, 2026.
Transparency logRelease files / pydantic_takibiapi-0.1.0-py3-none-any.whl
| Download URL | pydantic_takibiapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22eadfa2a37c22899ca97afaa3389816cbceee456a3fe5bd5929bbb604c674fd
|
|
BLAKE2b-256 checksum How to use checksums |
f9b701a520df002c2360b0646b1323a0c2821a726b1a1b58694b563f681345fb
|
| 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 3, 2026.
Transparency logSecurity for pydantic-takibiapi 0.1.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.
Attestation for pydantic_takibiapi-0.1.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 3, 2026.
Transparency logA 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.