Skip to main content

ashurbanipal (flask-python)

A Flask port of Ashurbanipal — implements the same spec/protocol.md + spec/openapi.yaml contract as the Rust reference and the Kotlin/Spring Boot, Go/net-http, and Node/Express ports. Ships three backends from day one: Postgres (psycopg), SQLite (stdlib sqlite3), and MySQL/MariaDB (PyMySQL) — see ashurbanipal/db/.

uv add ashurbanipal-flask       # or: pip install ashurbanipal-flask

Usage

from flask import Flask
from ashurbanipal import Config, router
from ashurbanipal.db.postgres import PgSource

config = Config(enabled=True)
source = PgSource(dsn=os.environ["DATABASE_URL"])

app = Flask(__name__)
app.register_blueprint(router(config, [("primary", source)]))

router takes an ordered, non-empty sequence of named sources rather than a single one — a host can register more than one DbSource (e.g. two Postgres databases) and a request's source query param selects which one it targets (spec/protocol.md §1, §5.8); the first entry is the default used when source is absent. A single-source deployment just registers one entry, as above.

Config() (the zero-argument default) is disabled by construction: enabled defaults to False — a host that forgets to configure anything gets a 404'd viewer, never one silently enabled with defaults. Ashurbanipal has zero opinion on what environment it's running in; that's the host's call entirely.

The optional fields, shown here at their defaults/example values:

from ashurbanipal import Config, Limits, Sibling

config = Config(
    enabled=True,
    limits=Limits(default_page_size=50, max_page_size=100, query_timeout_secs=5),
    siblings=[
        Sibling(
            name="billing",
            base_url="https://billing.internal.vpn/__ashurbanipal",
            health_path="/health",
        ),
    ],
)

Every backend opens one fresh physical connection per operation (no pool) — this trivially satisfies spec/protocol.md §1's "resolve the schema once per operation" invariant without the explicit transaction-pinning a pooled driver (Rust's sqlx::Pool) needs. A host wanting connection pooling wraps the driver call inside its own DbSource implementation.

Database support

Same per-backend degraded features and mechanisms as the Rust reference (comments/common-values unavailable on SQLite and MySQL, MySQL-vs-MariaDB runtime detection for the query-timeout mechanism) — see docs/adapter-decisions.md for the full registry. SqliteSource needs a real file path, not :memory:: SQLite's in-memory database is private per-connection, and this backend reconnects on every operation, so :memory: would be empty again on the next call.

ASHURBANIPAL_BACKEND=sqlite ASHURBANIPAL_SQLITE_PATH=./demo.db uv run python demo/app.py
ASHURBANIPAL_BACKEND=mysql MYSQL_TEST_URL=mysql://root:pw@host:3306/db uv run python demo/app.py

Full API/config reference: docs/design.md.

Download files

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

Source Distribution

ashurbanipal_flask-0.6.0.tar.gz (51.6 kB view details)

Uploaded Source

Built Distribution

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

ashurbanipal_flask-0.6.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file ashurbanipal_flask-0.6.0.tar.gz.

File metadata

  • Download URL: ashurbanipal_flask-0.6.0.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ashurbanipal_flask-0.6.0.tar.gz
Algorithm Hash digest
SHA256 67911ec98f604728631e2103bebb6e43d5e983f457250182716dbeb462ec1fa2
MD5 fd74f26e2dacb40198e07c9550a0823d
BLAKE2b-256 95d966ebad32c44a13e04b76fc04d19ef95e4302665b1e1b68a5b0986e442ae4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashurbanipal_flask-0.6.0.tar.gz:

Publisher: flask-python-publish.yml on mt-empty/ashurbanipal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ashurbanipal_flask-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ashurbanipal_flask-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89a9ce8b17ff056d8eba3390921aa6c5a627bee8523312e7628798b133031668
MD5 fbca4b54b263e561bbc545a3efd34462
BLAKE2b-256 833dc2e988d3b86f1a3eecea44c06b4a16a50736dbb3c04c46479ba6bb1a1bc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashurbanipal_flask-0.6.0-py3-none-any.whl:

Publisher: flask-python-publish.yml on mt-empty/ashurbanipal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.1.1

2 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