{"id":19329985,"url":"https://github.com/asynq-io/eventiq","last_synced_at":"2025-07-07T03:02:48.641Z","repository":{"id":250680721,"uuid":"829292414","full_name":"asynq-io/eventiq","owner":"asynq-io","description":"Asyncio native pub/sub framework for Python","archived":false,"fork":false,"pushed_at":"2025-02-13T10:29:03.000Z","size":172,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-02T04:35:00.472Z","etag":null,"topics":["asyncio","event-driven","framework","microservices","nats","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asynq-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T06:30:03.000Z","updated_at":"2025-02-15T20:40:50.000Z","dependencies_parsed_at":"2024-09-09T09:50:49.627Z","dependency_job_id":"54972e8b-427a-43c4-85b6-94c712d3f7fc","html_url":"https://github.com/asynq-io/eventiq","commit_stats":null,"previous_names":["asynq-io/eventiq"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asynq-io%2Feventiq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asynq-io%2Feventiq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asynq-io%2Feventiq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asynq-io%2Feventiq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asynq-io","download_url":"https://codeload.github.com/asynq-io/eventiq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250334149,"owners_count":21413518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","event-driven","framework","microservices","nats","python"],"created_at":"2024-11-10T02:33:01.519Z","updated_at":"2025-04-22T22:32:46.537Z","avatar_url":"https://github.com/asynq-io.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/asynq-io/eventiq/main/assets/logo.svg\" style=\"width: 250px\"\u003e\n\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cem\u003eAsyncio native pub/sub framework for Python\u003c/em\u003e\n\u003c/p\u003e\n\n![Tests](https://github.com/asynq-io/eventiq/workflows/Tests/badge.svg)\n![Build](https://github.com/asynq-io/eventiq/workflows/Publish/badge.svg)\n![License](https://img.shields.io/github/license/asynq-io/eventiq)\n![Mypy](https://img.shields.io/badge/mypy-checked-blue)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n![Python](https://img.shields.io/pypi/pyversions/eventiq)\n![Format](https://img.shields.io/pypi/format/eventiq)\n![PyPi](https://img.shields.io/pypi/v/eventiq)\n\n## Installation\n```shell\npip install eventiq\n```\nor\n```shell\npoetry add eventiq\n```\n\n### Installing optional dependencies\n\n```shell\npip install 'eventiq[broker]'\n```\n\n### Available brokers\n\n- `nats`\n- `rabbitmq`\n- `kafka`\n- `redis`\n\n## Features\n\n- Modern, `asyncio` based python 3.8+ syntax\n- Fully type annotated\n- Minimal external dependencies (`anyio`, `pydantic`, `typer`)\n- Automatic message parsing based on type annotations using `pydantic`\n- Code hot-reload\n- Highly scalable: each service can process hundreds of tasks concurrently,\n    all messages are load balanced between all instances by default\n- Resilient - at least once delivery for all messages by default (except for Redis*)\n- Customizable \u0026 pluggable message encoder/decoder (`json` as default)\n- Multiple broker support\n    - Memory (for testing)\n    - Nats\n    - Kafka\n    - Rabbitmq\n    - Redis\n- Result Backend implementation for Nats \u0026 Redis\n- Lifespan protocol support\n- Lightweight (and completely optional) dependency injection system based on type annotations\n- Easy and lightweight (~3k lines of code including types definitions and brokers implementations)\n- [Cloud Events](https://cloudevents.io/) standard as base message structure (no more python specific `*args` and `**kwargs` in messages)\n- [AsyncAPI](https://www.asyncapi.com/en) documentation generation from code\n- Twelve factor app approach - stdout logging, configuration through environment variables\n- Easily extensible via Middlewares\n- Multiple extensions and integrations including:\n  - Prometheus - mertics exporter\n  - OpenTelemetry - tracing and metrics\n  - Message Pack - message pack encoder for messages\n  - FastAPI - integrating eventiq Service with FastAPI applications (WIP)\n  - Dataref - data reference resolver for messages (WIP)\n  - Eventiq Workflows - orchestration engine built on top of eventiq (WIP)\n\n## Basic Usage\n\n```Python\nimport asyncio\nfrom eventiq import Service, Middleware, CloudEvent, GenericConsumer\nfrom eventiq.backends.nats import JetStreamBroker\n\nclass SendMessageMiddleware(Middleware):\n    async def after_broker_connect(self):\n        print(f\"After service start, running with {service.broker}\")\n        await asyncio.sleep(10)\n        for i in range(100):\n            message = CloudEvent(topic=\"test.topic\", data={\"counter\": i})\n            await service.publish(message)\n        print(\"Published messages(s)\")\n\nbroker = JetStreamBroker(url=\"nats://localhost:4222\")\n\nservice = Service(\n    name=\"example-service\",\n    broker=broker,\n)\nservice.add_middleware(SendMessageMiddleware)\n\n@service.subscribe(topic=\"test.topic\")\nasync def example_run(message: CloudEvent):\n    print(f\"Received Message {message.id} with data: {message.data}\")\n\n@service.subscribe(topic=\"test.topic2\")\nclass MyConsumer(GenericConsumer[CloudEvent]):\n    async def process(self, message: CloudEvent):\n        print(f\"Received Message {message.id} with data: {message.data}\")\n        await self.publish(CloudEvent(topic=\"test.topic\", data={\"response\": \"ok\"})\n\n```\n\nRun with\n\n```shell\neventiq run app:service --log-level=info\n```\n\n## Watching for changes\n\n```shell\neventiq run app:service --log-level=info --reload=.\n```\n\n## Testing\n\n`StubBroker` class is provided as in memory replacement for running unit tests\n\n```python\nimport os\n\n\ndef get_broker(**kwargs):\n    if os.getenv('ENV') == 'TEST':\n        from eventiq.backends.stub import StubBroker\n        return StubBroker()\n    else:\n        from eventiq.backends.rabbitmq import RabbitmqBroker\n        return RabbitmqBroker(**kwargs)\n\nbroker = get_broker()\n\n```\n\nFurthermore, subscribers are just regular python coroutines, so it's possible to test them simply by invocation\n\n```python\n\n# main.py\n@service.subscribe(topic=\"test.topic\")\nasync def my_subscriber(message: CloudEvent):\n    return 42\n\n# tests.py\nfrom main import my_subscriber\n\nasync def test_my_subscriber():\n    result = await my_subscriber(None)\n    assert result == 42\n\n```\n\n## CLI\n\nGetting help:\n```shell\neventiq --help\n```\n\nInstalling shell autocompletion:\n```shell\neventiq --install-completion [bash|zsh|fish|powershell|pwsh]\n```\n\nBasic commands\n\n- `run` - run service\n- `docs` - generate AsyncAPI docs\n- `send` - send message to broker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasynq-io%2Feventiq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasynq-io%2Feventiq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasynq-io%2Feventiq/lists"}