Skip to content

Repid

Repid's logo

Repid is a simple, fast, and extensible async task queue framework, with built-in AsyncAPI 3.0 schema generation.

PyPI version Coverage PyPI pyversions

Example

Here is how the easiest example of producer-consumer application can look like.

import asyncio
from repid import Repid, Router, InMemoryServer

# 1. Initialize the application and register a server
app = Repid()
app.servers.register_server("default", InMemoryServer(), is_default=True)

# 2. Create a router and an actor
router = Router()

@router.actor(channel="tasks")
async def my_awesome_actor(user_id: int) -> None:
    print(f"Processing for {user_id}")
    await asyncio.sleep(1.0)

app.include_router(router)

async def main() -> None:
    # 3. Open connection to interact with the queue
    async with app.servers.default.connection():
        # Producer: Send a message
        await app.send_message_json(
            channel="tasks",
            payload={"user_id": 123},
            headers={"topic": "my_awesome_actor"}
        )

        # Consumer: Run the worker loop (in a real app, this would be a separate process)
        await app.run_worker(messages_limit=1)

if __name__ == "__main__":
    asyncio.run(main())

Install

Repid supports Python 3.10 and later. Install it with pip:

pip install repid

Or with uv:

uv add repid

Install extras for the integrations you use:

  • pydantic - Pydantic deserialization support
  • amqp - AMQP 1.0 broker support
  • nats - NATS broker support
  • redis - Redis broker support
  • pubsub - GCP Pub/Sub broker support
  • kafka - Apache Kafka broker support
  • sqs - Amazon SQS broker support
pip install "repid[pydantic,amqp,nats,redis,pubsub,kafka,sqs]"

Why Repid?

Repid gives async Python applications a clean task queue API with type hints, schema generation, and broker flexibility built in.

  • AsyncAPI native: Repid inspects your actors and generates AsyncAPI 3.0 schemas with interactive web documentation, so your task contracts stay close to the code that handles them.
  • Typed message handling: With the pydantic, Repid can deserialize, validate, and coerce message payloads and headers before an actor runs.
  • Async-first performance: Repid keeps the worker path small and async-native, avoiding sync compatibility layers around broker I/O and actor execution.
  • Dependency injection: Actors can receive database connections, settings, clients, or other shared objects directly through their function signatures, keeping task code easier to test and reuse.
  • Broker flexibility: Use Repid as a producer, a consumer, or both. Broker implementations sit behind the same application API, so business logic stays separate from transport code.

LLMs

Repid documentation is available in text formats optimized for Large Language Models (LLMs) and AI coding assistants:

Inspiration

Repid is inspired by FastAPI, dramatiq and arq.

License

Repid is distributed under the terms of the MIT license. Please see License.md for more information.

Repid's logo is distributed under the terms of the CC BY-NC 4.0 license. It is originally created by ari_the_crow_.