SyntaxilitY PyPi Response Manager & Decorators
A Unified response manager and decorators for FAST APIs, REST APIs, Machine Learning, Deep Learning, and AI inference outputs.
Example for REST & FAST APIs:
from syntaxility_pypi_response_manager import (
SyntaxilitYPyPiResponseManager,
SyntaxilitYPagination
)
@app.get("/HTTP_200_OK", tags=["HTTP"])
def ok():
# try-catch block
try:
# Build pagination response
response = SyntaxilitYPagination.build_pagination_response(
metadata=[],
total=1,
page=1,
limit=1
)
return SyntaxilitYPyPiResponseManager.HTTP_200_OK(data=response, message="Data fetched successfully")
except Exception as e:
return SyntaxilitYPyPiResponseManager.HTTP_500_INTERNAL_SERVER_ERROR(message=str(e))
from syntaxility_pypi_response_manager import (
SyntaxilitYPyPiResponseManager,
SyntaxilitYPagination
)
@app.get("/HTTP_201_CREATED", tags=["HTTP"])
def created():
# try-catch block
try:
# Build pagination response
response = SyntaxilitYPagination.build_pagination_response(
metadata=[],
total=1,
page=1,
limit=1
)
return SyntaxilitYPyPiResponseManager.HTTP_201_CREATED(data=response, message="Data created successfully")
except Exception as e:
return SyntaxilitYPyPiResponseManager.HTTP_500_INTERNAL_SERVER_ERROR(message=str(e))
from syntaxility_pypi_response_manager import (
SyntaxilitYPyPiResponseManager,
SyntaxilitYPagination,
TryCatch
)
@app.get("/HTTP_201_CREATED", tags=["HTTP"])
# TryCatch is a decorator: will handle all the exceptions
# and return the appropriate response
@TryCatch
def created():
# Build pagination response
response = SyntaxilitYPagination.build_pagination_response(
metadata=[],
total=1,
page=1,
limit=1
)
return SyntaxilitYPyPiResponseManager.HTTP_201_CREATED(data=response, message="Data created successfully")
Example for ML:
ml_results = [
{"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("/ml-ok", tags=["ML"])
def ml_ok(page: int = Query(1, ge=1), limit: int = Query(2, ge=1)):
# Pagination params
pagination_params = SyntaxilitYPagination.get_pagination_params({"page": page, "limit": limit})
page, limit, skip = pagination_params["page"], pagination_params["limit"], pagination_params["skip"]
# Slice dataset
paginated_predictions = ml_results[skip: skip + limit]
# Build metadata including pagination info
metadata = {
"model": "test_model",
"version": "1.0",
"pagination": SyntaxilitYPagination.build_pagination_response(
metadata={},
total=len(ml_results),
page=page,
limit=limit
)["pagination"]
}
return SyntaxilitYPyPiResponseManager.ML_INFERENCE_OK(
predictions=paginated_predictions,
probabilities=None,
metadata=metadata,
message="Paginated ML inference results"
)
Licenses: MIT Free
Copyright (c) 2026 SyntaxilitY
Developer: Tariq Mehmood
"""
Metadata
Release files for syntaxility-pypi-response-manager 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| syntaxility_pypi_response_manager-1.0.0.tar.gz | 6.2 kB | Without provenance | Details for syntaxility_pypi_response_manager-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| syntaxility_pypi_response_manager-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for syntaxility_pypi_response_manager-1.0.0-py3-none-any.whl |
Total release size: 12.6 kB
Release files / syntaxility_pypi_response_manager-1.0.0.tar.gz
| Download URL | syntaxility_pypi_response_manager-1.0.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0f93e5c2c0334e9605af49432d0a615f5fc5263684f0af44a574b6b8989cfe3
|
|
BLAKE2b-256 checksum How to use checksums |
2e619af73c9d0be526f4b9049cfd4d9fb1467d3799a41948b7d8ff35c0255fda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / syntaxility_pypi_response_manager-1.0.0-py3-none-any.whl
| Download URL | syntaxility_pypi_response_manager-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d31531aa5a62f7cc82a58be44660b2a2d3483cf8e32f3cb1a105492a76600478
|
|
BLAKE2b-256 checksum How to use checksums |
4a16012ebb28a6f67d7239cf99093a8d886bb43e683bc2cebe4e2efd055cafc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for syntaxility-pypi-response-manager 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.