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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adaa1dbd11bbf8527083e64e3cc5482deeb65fb026c96e88d7b6bac4cb6149bb
|
|
| MD5 |
daced715f2bfbe99e1d7b3b6c197a941
|
|
| BLAKE2b-256 |
fd5a655a6184d105d16eaaafb8ef298a1eca40698a533c39770cd92a6d55f7c8
|
Provenance
The following attestation bundles were made for ashurbanipal_flask-0.4.0.tar.gz:
Publisher:
flask-python-publish.yml on mt-empty/ashurbanipal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ashurbanipal_flask-0.4.0.tar.gz -
Subject digest:
adaa1dbd11bbf8527083e64e3cc5482deeb65fb026c96e88d7b6bac4cb6149bb - Sigstore transparency entry: 2653094388
- Sigstore integration time:
-
Permalink:
mt-empty/ashurbanipal@a35c41e074758b2c9437eb946403fb1c0a1fa8aa -
Branch / Tag:
refs/tags/ashurbanipal-flask-v0.4.0 - Owner: https://github.com/mt-empty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
flask-python-publish.yml@a35c41e074758b2c9437eb946403fb1c0a1fa8aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file ashurbanipal_flask-0.4.0-py3-none-any.whl.
File metadata
- Download URL: ashurbanipal_flask-0.4.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2d5acbd72b36ea7a3ceae8bcf72de74e998add971184ec102872a664b4f3fc7
|
|
| MD5 |
ed772d16fed50cc57096b8fd8cacbf83
|
|
| BLAKE2b-256 |
c347ba1a0ce0fb8c980fb64d3dbf50da41b49f797a5035cf66f695e88638da52
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ashurbanipal_flask-0.4.0-py3-none-any.whl -
Subject digest:
a2d5acbd72b36ea7a3ceae8bcf72de74e998add971184ec102872a664b4f3fc7 - Sigstore transparency entry: 2653094432
- Sigstore integration time:
-
Permalink:
mt-empty/ashurbanipal@a35c41e074758b2c9437eb946403fb1c0a1fa8aa -
Branch / Tag:
refs/tags/ashurbanipal-flask-v0.4.0 - Owner: https://github.com/mt-empty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
flask-python-publish.yml@a35c41e074758b2c9437eb946403fb1c0a1fa8aa -
Trigger Event:
push
-
Statement type: