kamiwaza-extensions-lib
Runtime library for Kamiwaza extensions. Provides FastAPI auth middleware, identity extraction, a typed Kamiwaza model client, and session management for extension backends.
This package is intentionally separate from kamiwaza-sdk: extension
backends need a lightweight async library, not the full SDK with its sync
HTTP client and 20+ service modules.
Install
pip install 'kamiwaza-extensions-lib>=0.4.5,<0.5'
Usage
from kamiwaza_extensions_lib import (
KamiwazaExtClient,
platform_request,
require_auth,
extract_identity,
)
Calling platform APIs from an extension backend
Use platform_request() with the incoming FastAPI request and the exact,
canonical platform route. The path must be root-relative and include the
platform /api prefix; collection routes must include their canonical trailing
slash when the platform declares one:
response = await platform_request(
request,
"GET",
"/api/catalog/datasets/",
)
response.raise_for_status()
datasets = response.json()
The helper uses the container-routable platform URL, forwards the current
ForwardAuth envelope, and deliberately refuses to follow HTTP redirects. Set
the optional timeout= in seconds when the 30-second default is unsuitable.
Each call currently uses a short-lived client; connection pooling is tracked in
GitHub issue #63. Do not
construct absolute platform URLs or use a raw httpx.AsyncClient for
request-bound platform calls. Caller headers cannot replace the envelope's
authentication, routing, framing, or X-Request-Id correlation fields.
User-bound clients ignore HTTP_PROXY, HTTPS_PROXY, SSL_CERT_FILE, and
SSL_CERT_DIR. For a private CA, mount its PEM bundle in the backend container
and set KAMIWAZA_CA_BUNDLE to that file path. Do not disable certificate
verification in production.
The helper raises:
ValueErrorfor invalid paths, methods, headers, or caller overridesMisboundAuthErrorwhen the platform-provided ForwardAuth envelope is malformed or contains an ambiguous duplicate fieldUnexpectedContextErrorwhenKAMIWAZA_API_URLis missing or invalidPlatformRedirectError(a specializedUnexpectedContextError) when the canonical route redirectsPlatformOutageErrorfor network, timeout, or upstream protocol failures
See CHANGELOG.md in this directory for release notes.
Metadata
Release files for kamiwaza-extensions-lib 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kamiwaza_extensions_lib-0.4.5.tar.gz | 39.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kamiwaza_extensions_lib-0.4.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.1 kB
Release files / kamiwaza_extensions_lib-0.4.5.tar.gz
| Download URL | kamiwaza_extensions_lib-0.4.5.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d7b01a5fc9400a293d06c2ff5148ae251ba8e051f92b98ab57d4ab72dc6b4de
|
|
BLAKE2b-256 checksum How to use checksums |
2699a6668f69b0363df3e4b60189e17ab10407e399476416b4a409d1ab7d56a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / kamiwaza_extensions_lib-0.4.5-py3-none-any.whl
| Download URL | kamiwaza_extensions_lib-0.4.5-py3-none-any.whl |
|---|---|
| Size | 46.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7caf4e55101ea22e107421dbda6ac59242136526ef9b440cd68f208c0ffd62fb
|
|
BLAKE2b-256 checksum How to use checksums |
1626105cbc7c29556d32d7d94acc6b2171b59bbecd16097ca7bf2978f0f39f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|