Skip to main content

Entity- and action-centric API layer: build once, publish anywhere — expose XWAction/XWEntity over HTTP (FastAPI default, Flask engine) and consume the same contracts from client agents; OpenAPI, middleware, and production ops for the eXonware stack.

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.10 | Updated: 18-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

exonware_xwapi-0.9.0.10.tar.gz (196.6 kB view details)

Uploaded Source

Built Distribution

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

exonware_xwapi-0.9.0.10-py3-none-any.whl (168.3 kB view details)

Uploaded Python 3

File details

Details for the file exonware_xwapi-0.9.0.10.tar.gz.

File metadata

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

File hashes

Hashes for exonware_xwapi-0.9.0.10.tar.gz
Algorithm Hash digest
SHA256 3a70bcc19b3da9c9499b383b8de7bc96188b3ce43a9c185a9d0b03b498982088
MD5 33601be37c4b4ecd79df1fd9ae5148e6
BLAKE2b-256 ef5fd4b1116bfa754cbd5b081963456cb686b736bad81e9e08f1bf9880c70f66

See more details on using hashes here.

File details

Details for the file exonware_xwapi-0.9.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for exonware_xwapi-0.9.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 0d78e2f3433a3d3650a7d2a56b3ab4de3e819f058bac74f698de20121d438f3b
MD5 cba8c1d3cdf2efa689b14abe44c2e0aa
BLAKE2b-256 9b771cac505648ca11b3640003282417f69a377f14bd0fac421f2f09060d3241

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