Skip to main content

A lightweight and standardized API response utility for Python web API frameworks.

Project description

🕸️ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protogrid-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

protogrid-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file protogrid-1.0.0.tar.gz.

File metadata

  • Download URL: protogrid-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for protogrid-1.0.0.tar.gz
Algorithm Hash digest
SHA256 76593320dd8e083963ae19fe21707c8adbc5db643a6313ee98486c625c90537c
MD5 32272dc00e08a414a7d372c30e7c5a4e
BLAKE2b-256 e69273b40c78c353c7cdd8fb7bb5fcaed5c18472bef36dbbfa4f39eab86db28f

See more details on using hashes here.

File details

Details for the file protogrid-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: protogrid-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for protogrid-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57363a5081f54c0b165281caf41d4e09664b3f84dde94d6ef087f99ba975868b
MD5 46eec54a476593ecc50579996ce19a5c
BLAKE2b-256 c7953c9dc66da24b689400e3ce069484fbb988be9abcb2daee191b8e1824424c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page