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.

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.8.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.8.0
File Size Uploaded Provenance
ashurbanipal_flask-0.8.0.tar.gz 70.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 112.5 kB

Release files / ashurbanipal_flask-0.8.0.tar.gz

Download URL ashurbanipal_flask-0.8.0.tar.gz
Size 70.6 kB
Tags Source
SHA-256 checksum
How to use checksums
94005b7fbfffaea409274561fcf1f7dd73c9f6b5bc9033115ee8cb780c57810a
BLAKE2b-256 checksum
How to use checksums
1589d4d23316d582995825d87879a2bd965bf3408fbb76cbc1ed3ea1172f62b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 22, 2026.

Transparency log

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

Download URL ashurbanipal_flask-0.8.0-py3-none-any.whl
Size 41.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c136e7d04c572a7acaa6ae27de152c215e501b754d3c92a3b85c828ad42c68e6
BLAKE2b-256 checksum
How to use checksums
84d9c7f2adcb5275f2cb300349ec51948129f8128804ff633f141b9630d7618f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 22, 2026.

Transparency log

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ashurbanipal_flask-0.8.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 22, 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.

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