Skip to main content

🕸️ Protogrid

Standardized, Type-Safe API Responses for Python.

Protogrid is a lightweight library designed to enforce a consistent JSON structure across your services. It automates pagination logic, error formatting, and metadata injection so you can focus on your business logic.

🚀 Quick Start

from protogrid import make_response

user_data = {
    "user_id": 123,
    "name": "Alice"
}

return make_response(
    status=200,
    message="Request processed successfully",
    payload=user_data,
    page=1,
    limit=10,
    total_items=100,
    include_meta=True
)

📦 Response Structure

Protogrid ensures every response follows a predictable schema, making life easier for frontend consumers.

{
  "success": true,
  "message": "Request processed successfully",
  "http_code": 200,
  "payload": {
    "user_id": 123,
    "name": "Alice"
  },
  "pagination": {
    "page": 1,
    "limit": 10,
    "total_items": 100,
    "total_pages": 10,
    "has_next": true,
    "has_prev": false
  },
  "error": null,
  "meta": {
    "timestamp": "2026-02-13T15:58:20.000Z",
    "request_id": "req_123e4567-e89b-12d3-a456-426614174000"
  }
}

✨ Why Protogrid?

  • Consistency: Eliminates "snowflake" responses; your API always speaks the same language.
  • Zero Math: Automatic calculation of total_pages, has_next, and has_prev.
  • Framework Agnostic: Works seamlessly with FastAPI, Flask, Django, or even standalone scripts.
  • Type Safety: Built-in support for APIStatus enums and type-hinted payloads.
  • Traceability: Automatically includes request_id and ISO timestamps for easier debugging.

🛠️ Installation & Links

Resource Link
Source Code GitHub Repository
Documentation Full Docs
Latest Version v1.0.0 (Stable)

Note on v1.0.0: This release resolves "Status Swallowing" issues, ensuring that internal error states no longer mask the actual HTTP status codes.

Metadata

Release files for protogrid 1.0.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 protogrid 1.0.0
File Size Uploaded
protogrid-1.0.0.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for protogrid 1.0.0
File Interpreter ABI Platform
protogrid-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / protogrid-1.0.0.tar.gz

Download URL protogrid-1.0.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
76593320dd8e083963ae19fe21707c8adbc5db643a6313ee98486c625c90537c
BLAKE2b-256 checksum
How to use checksums
e69273b40c78c353c7cdd8fb7bb5fcaed5c18472bef36dbbfa4f39eab86db28f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / protogrid-1.0.0-py3-none-any.whl

Download URL protogrid-1.0.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57363a5081f54c0b165281caf41d4e09664b3f84dde94d6ef087f99ba975868b
BLAKE2b-256 checksum
How to use checksums
c7953c9dc66da24b689400e3ce069484fbb988be9abcb2daee191b8e1824424c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release files

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