Skip to main content

Convenience wrapper for exonware-xwapi - provides 'import xwapi' alias

Project description

xwapi

Build once, publish anywhere. xwapi is the entity- and exposable-action layer for eXonware: define xwaction operations and xwentity models once, then publish them over HTTP/OpenAPI (bots, consoles, and other adapters align to the same contracts). It also supports the other directionclients and agents that consume those actions via XWApiAgent and related client engines.

Default HTTP engine is FastAPI (full OpenAPI/async ecosystem); Flask is a registered alternate so you can swap ASGI vs WSGI at app construction without rewriting actions. See docs/REF_24_ALTERNATIVES.md for comparable libraries and engine notes.

Beyond HTTP wiring: standardized errors, production middleware, durable action pipeline, API token lifecycle/metering.

Longer guide: README_LONG.md.

Company: eXonware.com · Author: eXonware Backend Team · Email: connect@exonware.com

Status Python License


📦 Install

Install When to use
pip install exonware-xwapi Core runtime
pip install exonware-xwapi[lazy] Lazy dependency loading
pip install exonware-xwapi[full] Full production dependency set
pip install exonware-xwapi[engines-http] Optional HTTP engines (Starlette, Quart, Sanic, aiohttp, BlackSheep, Litestar, Django, Mangum)

🚀 Quick start

from exonware.xwapi import XWAPI
from exonware.xwentity import XWEntity


class User(XWEntity):
    name: str
    email: str
    age: int


api = XWAPI(entities=[User], title="My API", version="1.0.0")
app = api.create_app(engine="fastapi")

🆕 New production features

  • Engine-agnostic error contract: xwapi_error_to_http_parts plus adapters keeps XWAPIError transport-neutral.
  • Outbox + singleton worker pipeline: ActionPipelineManager, AOutboxStore/InMemoryOutboxStore, and BackgroundWorker.
  • API token lifecycle: create/list/revoke tokens, usage tracking, balance/recharge, idempotent metering.
  • Provider abstractions: IAuthProvider, IStorageProvider, IPaymentProvider with in-memory and library adapters.
  • API token middleware: bearer verification, optional scope enforcement, deny-unmapped policy, usage metering via Idempotency-Key.
  • Admin/operations endpoints: server status/health/pipeline controls and token admin endpoints.
  • Production guardrails: environment-based admin token enforcement and admin read-protection support.

💻 Client side

Use XWApiAgent (and client engines) to discover XWAction methods, attach auth/session flows, and treat remote APIs as the consumer half of the same exposable-action model.


🔗 eXonware integration

xwapi now explicitly integrates with:

  • xwsystem (serialization, logging/utilities)
  • xwaction (action registration and execution)
  • xwentity (entity-driven API surfaces)
  • xwschema (schema validation/generation integration points)
  • xwdata (data/serialization integration paths)

🌐 Ecosystem functional contributions

For xwapi, each XW library covers a specific feature and requirement boundary rather than acting as a generic dependency layer. You can use xwapi standalone with its core install and existing non-XW components. Adding more XW packages is optional and mainly useful when you want full enterprise and mission-critical infrastructure patterns under your own control.

Supporting XW lib What it provides to xwapi Functional requirement it satisfies
XWAction Metadata, registration, execution, and engine adapters for exposable actions (HTTP, and other surfaces). Same business action from server publish to client consume; reusable across FastAPI/Flask engines.
XWEntity Entity-first domain surface that xwapi can expose directly as API resources. Stable domain contracts and lower boilerplate for CRUD/API scaffolding.
XWSystem Shared error and runtime foundations (logging, config, async/helpers, transport-neutral utility layers). Uniform API behavior across FastAPI/Flask/GraphQL/gRPC and predictable ops behavior in production.
XWSchema Validation and schema integration points for request/response shaping and API contracts. Strong input/output contract enforcement and safer API evolution.
XWStorage Persistence abstraction used by server pipeline components and token/admin paths where durable state is needed. Durable action/outbox/token workflows instead of in-memory-only behavior.
XWAuth Authentication/authorization provider integrations used by middleware and protected routes. API security requirements (token validation, authz boundaries, tenant-safe access).
XWData Data transformation/serialization support for mixed payloads and format conversion paths. Multi-format payload handling without duplicating conversion logic in endpoint code.

This is the practical edge: one place composes publish (server) and consume (agent/client) paths around the same exposable actions, instead of stitching unrelated libraries per service.


📖 Docs and tests


⏱️ Async support

  • Core runtime includes async methods across facade, token manager, middleware paths, and server actions.
  • Async APIs are recommended for I/O-heavy and concurrent workloads.

Apache-2.0 - see LICENSE. Homepage: https://exonware.com Version: 0.9.0.4 | Updated: 08-Apr-2026

Built with ❤️ by eXonware.com - Revolutionizing Python Development Since 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xwapi-0.9.0.4.tar.gz (184.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xwapi-0.9.0.4-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file xwapi-0.9.0.4.tar.gz.

File metadata

  • Download URL: xwapi-0.9.0.4.tar.gz
  • Upload date:
  • Size: 184.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xwapi-0.9.0.4.tar.gz
Algorithm Hash digest
SHA256 45a3e2ef64972cb0582423cac3f25687f4f9a146d0b7fbe6fc1a8a936e16a321
MD5 7e2f34e05a7be71ae15fe479ef8c5780
BLAKE2b-256 1324b69010c6042990566b7f0a15853e25226f8a4aaf42d10bdde128b993dd1c

See more details on using hashes here.

File details

Details for the file xwapi-0.9.0.4-py3-none-any.whl.

File metadata

  • Download URL: xwapi-0.9.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xwapi-0.9.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d40f9e1f41bdeebbe81ca51b1c24e100b0a7976cb5c76dfe0816a189f0a91c84
MD5 9d5222c9b63a63394e530addb432437d
BLAKE2b-256 efcb33cd5745f222cee9a5fd1f4a75f53b4fdc8dfbd101c710ac01e833300ca9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page