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",
            dbviewer_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.3.0.tar.gz (47.9 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.3.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ashurbanipal_flask-0.3.0.tar.gz
  • Upload date:
  • Size: 47.9 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.3.0.tar.gz
Algorithm Hash digest
SHA256 bfe8e8bbb6f017a0c731c371750c585fa0affc23c5edd9d68b4f5898b6bff067
MD5 492528793504d76ae7c7287732de6f5c
BLAKE2b-256 82fee1f9207a6cb8c9a540e7b83cf463fc83788945ce38362c7fa823325abd32

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashurbanipal_flask-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ashurbanipal_flask-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c0e8ff1a162dfc53624eb9ab9c7dbb431416fabb03b29348a78bf24a7eecbc
MD5 7199d2df69ec0a556c3f9b9794b47bfc
BLAKE2b-256 43655a49bf79837d5d8b5326d690b4fc150335247e8c76cd98496ffb2b3610d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ashurbanipal_flask-0.3.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

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

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