Skip to main content

abstract-flask

Abstract Flask turns a nested dictionary of Python functions into a Flask API. The same route definitions can describe endpoints to a client, mount an application under a prefix and combine routes from several packages.

Installation

Use the aiohttp extra for the optional aiohttp integration and users for the PostgreSQL user utilities.

python -m pip install abstract-flask

Quick start

Build a route and exercise it with Flask’s in-process client.

from abstract_flask import get_Flask_app, spec

def double(value):
    return {"value": 2 * value}

routes = {"math": {"double": spec(double, "POST", response="native")}}
app = get_Flask_app(name="example", routes=routes)
response = app.test_client().post("/math/double", json={"value": 4})
print(response.get_json())  # {"value": 8}

Designing an API

  • Nested keys form URL segments. Use a key such as <int:item_id> to bind a path parameter.
  • A callable leaf uses the default result envelope. Use spec to declare HTTP methods, argument handling, status codes and native Flask responses. A list of specs can serve different methods at one path.
  • merge_categories combines independent route trees and reports duplicate leaves. describe_categories returns a machine-readable catalog.
  • get_Flask_app also accepts modules containing Flask Blueprints. Use url_prefix for a primary mount, dual_prefix for a second mount or arms_group to discover registered Python entry points.

Request and response handling

Use inputs="path" when a view should receive only URL variables. The default merged mode combines request fields with URL variables, with the URL value taking precedence. A native response can return a Flask response or a (payload, status) tuple. This lets related endpoints share the same registration tree while keeping their individual HTTP contracts.

Metadata

Release files for abstract-flask 0.0.0.1080

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

Source distribution (sdist)

Source distribution for abstract-flask 0.0.0.1080
File Size Uploaded Provenance Actions
abstract_flask-0.0.0.1080.tar.gz 36.7 kB Without provenance Details for abstract_flask-0.0.0.1080.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abstract-flask 0.0.0.1080
File Interpreter ABI Platform Actions
abstract_flask-0.0.0.1080-py3-none-any.whl Python 3 none any Details for abstract_flask-0.0.0.1080-py3-none-any.whl

Total release size: 72.0 kB

Release files / abstract_flask-0.0.0.1080.tar.gz

Download URL abstract_flask-0.0.0.1080.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
16b5f4c7edccd0f03b58195b4b983fb2c35ca2a6c1c2fadae2d87b2dfb48bf4e
BLAKE2b-256 checksum
How to use checksums
2f48c142af0c6963feab4655e0c67aed3f9fc9850b53126c2166dc7a4e8a9b8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / abstract_flask-0.0.0.1080-py3-none-any.whl

Download URL abstract_flask-0.0.0.1080-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18f4df9a398aa35b3f9df89658003ffaae29ebcc4f4e84e2779a33f55d80da4c
BLAKE2b-256 checksum
How to use checksums
b00f0698b3c2d17698b5cbb3dcab6a434a42d207b3990d4e73827d524d04b5af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for abstract-flask 0.0.0.1080

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.

Release history Release notifications | RSS feed

This release

0.0.0.1080 This release

2 release files No 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