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, Instance, Limits, Sibling

config = Config(
    enabled=True,
    limits=Limits(default_page_size=50, max_page_size=100, query_timeout_secs=5),
    instance=Instance(name="orders", label="dev"),  # spec/protocol.md §5.6
    # One shared list, in the same order, on every instance keeps the grid the same
    # everywhere. label is optional; typically an environment (dev, int) or a region (eu, us).
    siblings=[
        Sibling(
            name="orders",
            label="int",
            base_url="https://orders-int.internal.vpn/__ashurbanipal",
            health_path="/health",
        ),
        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.

Compression

The UI page is sent gzipped when the browser accepts gzip (spec/protocol.md §5.1); it is compressed once, at start-up. API responses are sent uncompressed. A host-wide Flask-Compress leaves the page alone, because it already carries Content-Encoding.

Behind your own auth

Ashurbanipal ships no authentication (docs/design.md §6); guard the mount prefix with your host's own. Cover the whole prefix, UI included, and check a role rather than just a login — otherwise every signed-in user can read every table the database role can.

router(...) returns a blueprint, so a blueprint-scoped hook covers only the viewer. Set it before registering:

bp = router(config, [("primary", source)])


@bp.before_request
def require_admin():
    if not is_admin():
        abort(401)


app.register_blueprint(bp)

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.

Metadata

Release files for ashurbanipal-flask 0.12.0

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

Source distribution (sdist)

Source distribution for ashurbanipal-flask 0.12.0
File Size Uploaded Provenance Actions
ashurbanipal_flask-0.12.0.tar.gz 78.9 kB With provenance Details for ashurbanipal_flask-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ashurbanipal-flask 0.12.0
File Interpreter ABI Platform Actions
ashurbanipal_flask-0.12.0-py3-none-any.whl Python 3 none any Details for ashurbanipal_flask-0.12.0-py3-none-any.whl

Total release size: 122.5 kB

Release files / ashurbanipal_flask-0.12.0.tar.gz

Download URL ashurbanipal_flask-0.12.0.tar.gz
Size 78.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e6caadf6e2a9b6897c5a0e8b4fc0167669518bdb1b6daf090f7a4f9ada2a80c8
BLAKE2b-256 checksum
How to use checksums
62001423899251a3c427ff21e364f9846127a4cf12de6c07c843c4381ed64911
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

Release files / ashurbanipal_flask-0.12.0-py3-none-any.whl

Download URL ashurbanipal_flask-0.12.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03b1c836dccabc034576080d119379f54fd98a29b662a9a3dc4850e0cf2a49ce
BLAKE2b-256 checksum
How to use checksums
a18ed4654056669f4178008588eef0dc41a47d8b149b8600457f7f1879464669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 30, 2026.

Transparency log

Security for ashurbanipal-flask 0.12.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ashurbanipal_flask-0.12.0.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 Oct 30, 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.

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