Skip to main content

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, TakibiAPI, createRoute, z


class Message(z.StrictObject):
    message = z.string()


MessageSchema = Message.openapi("Message")  # components.schemas.Message, referenced with $ref


class getTakibiRoute(
    createRoute(
        {
            "method": "get",
            "path": "/takibi",
            "responses": {200: {"description": "takibi🔥", "content": {"application/json": {"schema": MessageSchema}}}},
        }
    )
):
    """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 and z from zopy_takibiapi; everything else works as in Takibi.

Schemas

Every object, nested ones included, must be z.StrictObject; 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

As in Zod, only .openapi("Name") 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: bazel test //pypi/zopy-takibiapi:test. See the root README.

License

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

Metadata

Release files for zopy-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)

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

Built distribution (wheel)

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

Total release size: 15.6 kB

Release files / zopy_takibiapi-0.1.0.tar.gz

Download URL zopy_takibiapi-0.1.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e208d9b174059c0774f46e48872bdc768c3d2e5f24343b82e15a94fa6d4e94ae
BLAKE2b-256 checksum
How to use checksums
3e36169f5fc3ff9786aa23470448ad927234b9f7a2638fe15d45373d91089411
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 log

Release files / zopy_takibiapi-0.1.0-py3-none-any.whl

Download URL zopy_takibiapi-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbd9844e61ebe7dff52c6128a90e21d1f0826353434424d73ea21b2d97f1fac6
BLAKE2b-256 checksum
How to use checksums
591faa4ec71fff28115e7d4d3539ec431b42c2f8e36d57d9ba67ce27654cacd7
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 log

Security for zopy-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.

Select from 2 files

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