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.6 | Updated: 11-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.6.tar.gz (187.5 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.6-py3-none-any.whl (164.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: exonware_xwapi-0.9.0.6.tar.gz
  • Upload date:
  • Size: 187.5 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.6.tar.gz
Algorithm Hash digest
SHA256 3609da666a25916e69debfde8beaa063a67f9d902b6bdbc1f5b1177f4a1337f4
MD5 374f5bddc180aaa4a771c156b8d12638
BLAKE2b-256 c70f6e04167828c04299e140f9a17fbaede5d3e5d62ff371a3b7a8229bac5da7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for exonware_xwapi-0.9.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 456cd28a77e5edd40d0fc8d4319e5f3e10b7ac6a6bafa6298469bf63d3871f76
MD5 63a2c1862f772fc3a5944735bdb32f97
BLAKE2b-256 c7ae62537046207f21f0c8a09a6f426cf2c15513898d96734d4d8e61207f7de1

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