Skip to main content
Change of provenance

The repository or configuration that created this release differ from a previous release. View details.

zopy-takibiapi

TakibiAPI with zopy (Zod for Python) schemas, checked strictly: checks, unknown keys and responses included.

pip install zopy-takibiapi

Quick start

from zopy_takibiapi import Context, OpenAPIObject, TakibiAPI, createRoute, z


class Message(OpenAPIObject, openapi="Message"):  # components.schemas.Message, referenced with $ref
    message = z.string().openapi({"example": "takibi🔥"})


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🔥"), 200)


app = TakibiAPI()
app.openapi(getTakibiRoute, getTakibiRouteHandler)
app.doc("/doc", {"openapi": "3.0.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, OpenAPIObject and z from zopy_takibiapi; everything else works as in Takibi.

Schemas

Every object, nested ones included, must be z.StrictObject (or OpenAPIObject, which is one); app.openapi raises TypeError for a loose object or a non-zopy schema. Parameters arrive as text and are parsed as Zod parses them, so convert explicitly: todoId = z.coerce.number().int().

Checks

  • Requests: c.req.valid(...) gives the parsed value. A failure gets 422 with Zod's issue codes as code.
  • Responses: c.json(value, status) encodes value with the schema declared for that status (safeEncode: checked, codecs to their wire form). 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

The OpenAPI metadata is written with the schema, as in @hono/zod-openapi:

class Todo(OpenAPIObject, openapi="Todo"):  # z.object({...}).openapi("Todo")
    id = z.int().positive().openapi({"example": 1})
    title = z.string().openapi({"description": "What to do"})


class Tag(OpenAPIObject, openapi={"id": "Tag", "description": "A label"}):  # a name and metadata
    name = z.string()

OpenAPIObject is a z.StrictObject whose class keyword openapi= names it: the class itself becomes components.schemas.Todo, referenced with $ref wherever it is used, so one name serves as the route's schema and as the type the handler returns (c.json(Todo(...))). A mapping without "id" adds metadata only, and a subclass is unnamed until it says otherwise. zopy's Todo.openapi("Todo") still works, but names a copy of the class.

As in Zod, only named schemas become components; others are written in place. Documents come from zopy's toJSONSchema (openapi-3.0 or JSON Schema 2020-12).

Development

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

License

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

Metadata

Release files for zopy-takibiapi 0.2.0

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

Change of provenance

The repository or configuration that created these release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Source distribution (sdist)

Source distribution for zopy-takibiapi 0.2.0
File Size Uploaded Provenance Actions
zopy_takibiapi-0.2.0.tar.gz 8.1 kB With provenance Details for zopy_takibiapi-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.4 kB

Release files / zopy_takibiapi-0.2.0.tar.gz

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL zopy_takibiapi-0.2.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
043f2bd6845f838e03192825deeb44d1d24830667d1bd6e113d77104cc696dc3
BLAKE2b-256 checksum
How to use checksums
7045fb4b7c726e00337a103b24da8bff19aa0afa8759b706896c6f45cc78448e
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 / zopy_takibiapi-0.2.0-py3-none-any.whl

Change of provenance

This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.

We recommend inspecting the repository and configuration before proceeding. View details.

Download URL zopy_takibiapi-0.2.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25758cbb76396f3ae7913cdbdf96f2dd21f4a406d56a0601f085033409457a04
BLAKE2b-256 checksum
How to use checksums
2b486c14e0f8622d828ab125891865f9c950cc727141afccf53b0fd4fbc12035
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 zopy-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.

Change of provenance

The repository and configuration that created this release differ from a previous release.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Select from 2 files

Attestation for zopy_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