Skip to main content

SyntaxilitY Response Manager

A unified response manager and decorators for FastAPI, Flask, Django, Machine Learning, Deep Learning, and AI inference outputs.


Installation

# FastAPI
pip install syntaxility-response-manager[fastapi]

# Flask
pip install syntaxility-response-manager[flask]

# Django / DRF
pip install syntaxility-response-manager[django]

# ML / NumPy extras
pip install syntaxility-response-manager[ml]

# Everything
pip install syntaxility-response-manager[all]

FastAPI Examples

HTTP 200 OK

from fastapi import FastAPI
from syntaxility_response_manager import SyntaxilitYResponseManager, SyntaxilitYPagination

app = FastAPI()

@app.get("/users", tags=["HTTP"])
def list_users():
    try:
        response = SyntaxilitYPagination.build_pagination_response(
            metadata=[],
            total=1,
            page=1,
            limit=10,
        )
        return SyntaxilitYResponseManager.HTTP_200_OK(
            data=response,
            message="Users fetched successfully",
        )
    except Exception as e:
        return SyntaxilitYResponseManager.HTTP_500_INTERNAL_SERVER_ERROR(
            message=str(e)
        )

HTTP 201 Created with @TryCatch

from syntaxility_response_manager import SyntaxilitYResponseManager, TryCatch

@app.post("/users", tags=["HTTP"])
@TryCatch
def create_user():
    return SyntaxilitYResponseManager.HTTP_201_CREATED(
        data={"id": 1, "name": "Alice"},
        message="User created successfully",
    )

Flask Examples

from flask import Flask
from syntaxility_response_manager import SyntaxilitYResponseManager, TryCatch

app = Flask(__name__)

@app.route("/users")
@TryCatch
def list_users():
    return SyntaxilitYResponseManager.HTTP_200_OK(
        data={"users": []},
        message="Users fetched",
    )

Django Examples

# views.py
from syntaxility_response_manager import SyntaxilitYResponseManager, TryCatch

@TryCatch
def list_users(request):
    return SyntaxilitYResponseManager.HTTP_200_OK(
        data={"users": []},
        message="Users fetched",
    )

ML / AI Examples

Paginated ML Inference

from fastapi import FastAPI, Query
from syntaxility_response_manager import SyntaxilitYResponseManager, SyntaxilitYPagination

app  = FastAPI()
data = [
    {"input": [1, 2],  "prediction": 0},
    {"input": [3, 4],  "prediction": 1},
    {"input": [5, 6],  "prediction": 1},
    {"input": [7, 8],  "prediction": 0},
    {"input": [9, 10], "prediction": 1},
]

@app.post("/predict", tags=["ML"])
def predict(page: int = Query(1, ge=1), limit: int = Query(2, ge=1)):
    params  = SyntaxilitYPagination.get_pagination_params(
        {"page": page, "limit": limit}
    )
    page, limit, skip = params["page"], params["limit"], params["skip"]
    batch  = data[skip: skip + limit]
    paging = SyntaxilitYPagination.build_pagination_response(
        metadata={}, total=len(data), page=page, limit=limit
    )
    return SyntaxilitYResponseManager.ML_INFERENCE_OK(
        predictions=batch,
        metadata={"model": "clf_v1", "version": "1.0", "pagination": paging["pagination"]},
        message="Paginated inference results",
    )

ML Error Responses

SyntaxilitYResponseManager.ML_INFERENCE_FAILED(message="GPU OOM")
SyntaxilitYResponseManager.ML_INFERENCE_PARTIAL(predictions=[0, None, 1])
SyntaxilitYResponseManager.ML_MODEL_NOT_FOUND(message="Model 'clf_v3' not found")
SyntaxilitYResponseManager.ML_INVALID_INPUT(message="Expected shape (N, 4), got (N, 3)")

Using Individual Services Directly

from syntaxility_response_manager.services import (
    FastAPIResponseService,
    FlaskResponseService,
    DjangoResponseService,
    MLResponseService,
)

# FastAPI
fastapi_svc = FastAPIResponseService()
fastapi_svc.HTTP_200_OK(data={...})

# Flask
flask_svc = FlaskResponseService()
flask_svc.HTTP_404_NOT_FOUND(message="Item not found")

# Django
django_svc = DjangoResponseService()
django_svc.HTTP_201_CREATED(data={...})

# ML
ml_svc = MLResponseService()
ml_svc.ML_INFERENCE_OK(predictions=[0, 1, 1])

License

MIT — Copyright © 2026 SyntaxilitY

Developer: Tariq Mehmood
GitHub: SyntaxilitY
LinkedIn: Tariq Mehmood

Release files for syntaxility-response-manager 2.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 syntaxility-response-manager 2.0.0
File Size Uploaded
syntaxility_response_manager-2.0.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for syntaxility-response-manager 2.0.0
File Interpreter ABI Platform
syntaxility_response_manager-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.5 kB

Release files / syntaxility_response_manager-2.0.0.tar.gz

Download URL syntaxility_response_manager-2.0.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0eccebfc44902a564fb069eefceadde2012877fb2aa8ccc962dcfaede65cc95b
BLAKE2b-256 checksum
How to use checksums
bbf33b7ecf1387c86c73dde98955633641085086d448d6129fa9e0ec2bff8546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / syntaxility_response_manager-2.0.0-py3-none-any.whl

Download URL syntaxility_response_manager-2.0.0-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff21d7525287268bb6b743b8e3a344a3a39f977dec22637189124522c8961f97
BLAKE2b-256 checksum
How to use checksums
e42519c6623445b5ec472f10385ad9184f8faf68abe2704af345eabef41c1e64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.0.0 This release

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