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.4.0.tar.gz (50.5 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.4.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ashurbanipal_flask-0.4.0.tar.gz
  • Upload date:
  • Size: 50.5 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.4.0.tar.gz
Algorithm Hash digest
SHA256 adaa1dbd11bbf8527083e64e3cc5482deeb65fb026c96e88d7b6bac4cb6149bb
MD5 daced715f2bfbe99e1d7b3b6c197a941
BLAKE2b-256 fd5a655a6184d105d16eaaafb8ef298a1eca40698a533c39770cd92a6d55f7c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ashurbanipal_flask-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d5acbd72b36ea7a3ceae8bcf72de74e998add971184ec102872a664b4f3fc7
MD5 ed772d16fed50cc57096b8fd8cacbf83
BLAKE2b-256 c347ba1a0ce0fb8c980fb64d3dbf50da41b49f797a5035cf66f695e88638da52

See more details on using hashes here.

Provenance

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

This release

0.4.0 This release

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