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.7 | Updated: 12-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.7.tar.gz (186.4 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.7-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xwapi-0.9.0.7.tar.gz
  • Upload date:
  • Size: 186.4 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.7.tar.gz
Algorithm Hash digest
SHA256 cccb68ac72920bbd4f4e356f4193cda0072053dafdc872b03d9f471e7cd1eeeb
MD5 024d8bfac90fbeb3896934ddbc42b670
BLAKE2b-256 135969ae1d0e9dc1a72c6c6fae51e5c0cb895f131777a6b3361ba50a617d975b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xwapi-0.9.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8ef2d023ad8bee41d2b27763b907d45b4c756f94fb1af237e28a70c523bb27eb
MD5 81b8b71ca2de0b76808d938e737cbd7c
BLAKE2b-256 09032fd664c493fa4d79b19006b9dad73e75ab8527ec31a57e9a7b2b2bb2639a

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