Abstract Backend
Abstract Backend provides a pluggable backend layer for Python services. Applications code against shared protocols while concrete providers—Redis, Kafka, AWS SQS, or your own implementation—are discovered at runtime. Install a provider with pip, remove it with pip uninstall, and keep your business logic unchanged.
Status & Quality
CI/CD & Testing
Code Coverage & Quality
Code Style & Standards
Package Info
Downloads
Why it exists
- 🚫 Stop copying backend code – Extracted from real MCP server projects so multiple services can share the same queue abstraction.
- 📐 Protocol-first design – Contracts live in
abe/types.py, keeping providers honest with structural typing and contract tests. - 🔍 Runtime discovery –
load_backend()selects implementations via Python entry points, driven by environment variables. - 📊 Operational clarity – Logging helpers, contract suites, and documentation make backends observable and portable.
Features
- 📮 Queue provider protocols covering publish, consume, and lifecycle operations.
- ⚙️ AsyncLoopConsumer helper to execute handlers against any compliant backend.
- 🪵 Logging utilities for consistent configuration across providers and apps.
- 🧪 Contract tests to validate third-party implementations.
- 📚 Documentation & examples detailing architecture, provider lifecycle, and runtime flow.
Installation
Install the core library:
pip install abstract-backend
Then install one or more providers, for example the Redis backend:
pip install abe-redis
Set QUEUE_BACKEND=redis (the entry-point exposed by abe-redis) and load_backend() will resolve the correct provider at runtime.
Quick start ⚡️
from abe.backends.message_queue.loader import load_backend
from abe.backends.message_queue.consumer import AsyncLoopConsumer
async def process(payload: dict[str, object]) -> None:
...
async def main() -> None:
backend = load_backend()
consumer = AsyncLoopConsumer(backend, group="billing")
await consumer.run(process)
See docs/contents/development/architecture/ for diagrams explaining the flow and provider relationships.
Building providers 🧩
- Implement the protocols from
abe/types.py(especiallyMessageQueueBackendProtocol). - Expose a
from_env()constructor for runtime configuration. - Register an entry point under
abe.backends.message_queueinpyproject.toml. - Run the contract tests in
test/contract_test/backends/message_queue/against your provider. - Publish your package to PyPI; users activate it with
pip installandQUEUE_BACKEND.
The showcase at /docs/src/pages/showcase.tsx highlights template and reference implementations such as abe-redis.
Development 🛠️
- Install dev dependencies with
uv pip install -r pyproject.tomlor your preferred tool. - Run tests:
uv run pytest. - Type checking:
uv run mypy. - Linting:
uv run pylint abe tests.
The project follows black formatting and pylint linting (see .pre-commit-config.yaml).
Documentation & showcase 📖
- Developer docs live under
docs/contents/development/and include architecture, provider lifecycle, and layer integration guides. - A Showcase page (
/docs/src/pages/showcase.tsx) lists template and implementation repositories with release badges. - Run
cd docs && pnpm startfor local previews.
CI/CD & workflows 🤖
- GitHub Actions definitions reside in
.github/workflows/. - Reusable workflows leverage the logging, testing, and packaging helpers of this project.
docusaurus.config.tsanddocs/contents/development/sidebars.tsmanage documentation navigation.
License
This project is licensed under the MIT License.
Metadata
Release files for abstract-backend 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| abstract_backend-0.0.1.tar.gz | 16.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abstract_backend-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.3 kB
Release files / abstract_backend-0.0.1.tar.gz
| Download URL | abstract_backend-0.0.1.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b716fc23f937cf96b4693e7663dbec143b59e6f12e7a4eccc566b99cdd73c2ed
|
|
BLAKE2b-256 checksum How to use checksums |
993c2fde5cac67d4ba3b1544638acfb0ea0119c27d5d37f1e1a4dc0e2529fdee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / abstract_backend-0.0.1-py3-none-any.whl
| Download URL | abstract_backend-0.0.1-py3-none-any.whl |
|---|---|
| Size | 23.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f59200b098633d9150e41953a8fec8610047e14afdb5ef9e4986dcc6b99d485
|
|
BLAKE2b-256 checksum How to use checksums |
c2119b98d704f6b908a5ea60652de0bd497e58aae1e342031333076880536f95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Security for abstract-backend 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.