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.5.0.tar.gz (45.7 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.5.0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ashurbanipal_flask-0.5.0.tar.gz
  • Upload date:
  • Size: 45.7 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.5.0.tar.gz
Algorithm Hash digest
SHA256 08407b59aeed46df6d04369682c180638dd44238453ed451c7eacd494a57df04
MD5 f51d8e5e08b0100629639b02f6cd3c3f
BLAKE2b-256 cbcc7e7c95921f84884aff37052da00f75842c4e63af3613eb769f07c66f99f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ashurbanipal_flask-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48ed81e3e6ac9275b6b155a8799f3ba63af9639c33b28e674969d19b70bb12b4
MD5 5ef7213956459debf409c5765d0bbe87
BLAKE2b-256 d09cf74082cd8264607374a431eb00e02b03c8b867d21fb6dd28f8bc479d4556

See more details on using hashes here.

Provenance

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

This release

0.5.0 This release

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