Skip to main content

pronto-rest

Shared API utilities for FastAPI projects.

What's included

pronto_rest.v1 — stable public API:

  • ApiResponse[T] — generic response envelope that every endpoint returns. Carries either a typed data payload (on success) or an ApiError (on failure), never both.
  • ApiError — structured error model with a machine-readable code, a human-readable message, and an optional details dict.
  • EmptyData — use as the data type when an operation succeeds but returns no domain payload.

Installation

pip install pronto-rest

Or, for local development with editable install:

pip install -e ".[dev]"

Usage

from pronto_rest.v1 import ApiResponse, ApiError

# Success response
response = ApiResponse.ok(
    data={"id": "123", "name": "Alice"},
    operation="create_user",
    endpoint="/api/v1/users/create",
)

# Error response
response = ApiResponse.fail(
    code="USER_NOT_FOUND",
    message="No user with that ID exists.",
    operation="get_user",
    endpoint="/api/v1/users/123",
    details={"user_id": "123"},
)

With FastAPI

from fastapi import APIRouter
from pronto_rest.v1 import ApiResponse, EmptyData

router = APIRouter()

@router.post("/users/create", response_model=ApiResponse[UserOut])
def create_user(body: UserIn) -> ApiResponse[UserOut]:
    user = db.create(body)
    return ApiResponse.ok(
        data=UserOut.model_validate(user),
        operation="create_user",
        endpoint="/api/v1/users/create",
    )

Response envelope shape

Every response shares this envelope:

Field Type Description
api_version str Always "1.0"
status "success" | "error" Outcome of the operation
correlation_id str (UUID) Trace ID; echoed from X-Correlation-ID header if present
timestamp datetime UTC timestamp of when the response was generated
operation str Logical operation name (e.g. create_user)
endpoint str Request path (e.g. /api/v1/users/create)
data T | null Response payload; null on error
error ApiError | null Error details; null on success

status="success" requires data and forbids error. status="error" requires error and forbids data.

Development

Run tests:

pytest

Versioning

Versions are derived from git tags via hatch-vcs. The file src/pronto_rest/_version.py is auto-generated at build time and is not tracked in version control — the git tag is the source of truth.

To release a new version, tag a commit and build:

git tag v0.2.0
hatch build

Metadata

Release files for pronto-rest 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pronto-rest 0.0.1
File Size Uploaded Provenance
pronto_rest-0.0.1.tar.gz 10.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pronto-rest 0.0.1
File Interpreter ABI Platform
pronto_rest-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.7 kB

Release files / pronto_rest-0.0.1.tar.gz

Download URL pronto_rest-0.0.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c1eb39fc7ba19c5713e3f83a7661bcae1b0a2bfdd0ba25d9a3f40b8cfab7e9d8
BLAKE2b-256 checksum
How to use checksums
ae4197ba53594c5792f56eacc627dea3bb00e5b7b8acd76932fe91dbcb8f1feb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 25, 2026.

Transparency log

Release files / pronto_rest-0.0.1-py3-none-any.whl

Download URL pronto_rest-0.0.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28a68c5a5af3d744feb091edc7b7f9527cfee340f8ae510252489302b7e988f5
BLAKE2b-256 checksum
How to use checksums
8a12aa8d278390daf7fdc811235dd701068de90fbeb977738e9db57bf68786e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 25, 2026.

Transparency log

Security for pronto-rest 0.0.1

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 pronto_rest-0.0.1.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 May 25, 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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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