Skip to content

Commit 1fc2be9

Browse files
authored
Merge pull request #1 from firstunicorn/rename/messagekit
refactor(rename): rename import package from messaging to messagekit
2 parents 849fbbc + d4d366a commit 1fc2be9

205 files changed

Lines changed: 494 additions & 486 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.importlinter

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[importlinter]
2-
root_package = messaging
2+
root_package = messagekit
33

44
[importlinter:contract:layers]
55
name = Clean Architecture layer independence
66
type = layers
77
layers =
8-
messaging.presentation
9-
messaging.infrastructure
10-
messaging.application
11-
messaging.domain
12-
messaging.core
8+
messagekit.presentation
9+
messagekit.infrastructure
10+
messagekit.application
11+
messagekit.domain
12+
messagekit.core

.vulture-whitelist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# Triggers skip_broker_in_tests fixture execution via pytest dependency injection
1212
skip_broker_in_tests # Used in: async_client fixture (sets TESTING_SKIP_BROKER env var)
1313

14-
# === src/messaging/infrastructure/pubsub/broker_config/_factory_helpers.py:34 ===
15-
# === src/messaging/infrastructure/pubsub/rabbit_broker_config/_factory_helpers.py:36 ===
14+
# === src/messagekit/infrastructure/pubsub/broker_config/_factory_helpers.py:34 ===
15+
# === src/messagekit/infrastructure/pubsub/rabbit_broker_config/_factory_helpers.py:36 ===
1616
# circuit_breaker_factory(msg, context) - required by FastStream middleware interface
1717
# REFERENCE: https://faststream.ag2.ai/latest/getting-started/middlewares/middleware/
1818
# NOTE: ARG001 suppressed inline in source. Vulture still detects as unused (expected).

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ Package-first universal event infrastructure for microservices.
2626
## Installation
2727

2828
```bash
29-
pip install python-eventing
29+
pip install messagekit
3030
# or
31-
poetry add python-eventing
31+
poetry add messagekit
3232
```
3333

34-
**Import package name:** `messaging` (distribution is `python-eventing`)
34+
**Import package name:** `messagekit` (distribution is `messagekit`)
3535

3636
```python
37-
from messaging.core import BaseEvent
38-
from messaging.infrastructure import SqlAlchemyOutboxRepository
37+
from messagekit.core import BaseEvent
38+
from messagekit.infrastructure import SqlAlchemyOutboxRepository
3939
```
4040

4141
**Requirements:**
@@ -47,15 +47,15 @@ Support scale: `❌` none, `✅` basic, `✅✅` strong, `✅✅✅` first-class
4747

4848
## Comparison with alternatives
4949

50-
`python-eventing` prioritizes **durable messaging** (transactional outbox + CDC) and **Kafka/RabbitMQ integration** over in-process event simplicity:
50+
`messagekit` prioritizes **durable messaging** (transactional outbox + CDC) and **Kafka/RabbitMQ integration** over in-process event simplicity:
5151

52-
| Capability | `python-eventing` | [`pyventus`](https://github.com/mdapena/pyventus) | [`fastapi-events`](https://github.com/melvinkcx/fastapi-events) | Notes |
52+
| Capability | `messagekit` | [`pyventus`](https://github.com/mdapena/pyventus) | [`fastapi-events`](https://github.com/melvinkcx/fastapi-events) | Notes |
5353
| --- | --- | --- | --- | --- |
5454
| Transactional outbox | ✅✅✅ ||| Durable local DB plus outbox boundary is a core feature here |
5555
| Kafka data plane | ✅✅✅ ||| This package is built for Kafka-backed microservice messaging |
5656
| DLQ handling | ✅✅✅ ||| Leverages native RabbitMQ DLX and Kafka Connect DLQ SMT with database bookkeeping |
5757
| Health checks for eventing runtime | ✅✅✅ ||| Outbox health checks plus FastStream ASGI broker health endpoint |
58-
| Typed cross-service event contracts | ✅✅ || ✅✅ | `python-eventing` and `fastapi-events` are stronger on explicit payload modeling |
58+
| Typed cross-service event contracts | ✅✅ || ✅✅ | `messagekit` and `fastapi-events` are stronger on explicit payload modeling |
5959
| Decorator subscriber registration | ✅✅ | ✅✅✅ | ✅✅ | `EventBus.subscriber(...)` exists now; `pyventus` is still the most polished here |
6060
| In-process dispatch backend abstraction | ✅✅ | ✅✅✅ || `DispatchBackend` exists here; `pyventus` offers a broader processor model |
6161
| Lifecycle hooks / callbacks | ✅✅ | ✅✅✅ || `DispatchHooks` covers dispatch, success, failure, disabled, and debug |
@@ -70,7 +70,7 @@ Support scale: `❌` none, `✅` basic, `✅✅` strong, `✅✅✅` first-class
7070

7171
## When to use this package
7272

73-
**Use `python-eventing` if you need:**
73+
**Use `messagekit` if you need:**
7474
- Guaranteed event delivery via transactional outbox pattern
7575
- Kafka-based microservice messaging with CDC publishing
7676
- Dead letter queue handling with database bookkeeping
@@ -220,7 +220,7 @@ flowchart LR
220220
│ YOUR SERVICE (FastAPI) │
221221
│ │
222222
│ ┌──────────────┐ ┌──────────────────────────────────────────────┐ │
223-
│ │ Routes │──┬──▶│ python-eventing (SHARED CONTRACTS) │ │
223+
│ │ Routes │──┬──▶│ messagekit (SHARED CONTRACTS) │ │
224224
│ └──────────────┘ │ │ │ │
225225
│ │ │ • BaseEvent (Pydantic base) │ │
226226
│ │ │ • IOutboxRepository (Protocol) │ │
@@ -229,7 +229,7 @@ flowchart LR
229229
│ │ │ Uses contracts │
230230
│ │ ▼ │
231231
│ │ ┌──────────────────────────────────────────────┐ │
232-
│ │ │ python-eventing (implementations) │ │
232+
│ │ │ messagekit (implementations) │ │
233233
│ │ │ │ │
234234
│ │ │ ┌────────────────────────────────────────┐ │ │
235235
│ │ │ │ WRITE SIDE (Primary) │ │ │
@@ -310,7 +310,7 @@ flowchart LR
310310
│ │ DOWNSTREAM SERVICES │
311311
│ │ │
312312
│ │ ┌──────────────────────────────────────────────┐ │
313-
│ │ │ READ SIDE (python-eventing) │ │
313+
│ │ │ READ SIDE (messagekit) │ │
314314
│ │ │ │ │
315315
│ │ │ @broker.subscriber("user.created") │ │
316316
│ │ │ async def handle(event: UserCreated): │ │
@@ -412,7 +412,7 @@ async def handle_user_created(event: UserCreatedEvent): # ✅ Already a Pydanti
412412
- 🏥 **Native health checks**: `make_ping_asgi` endpoint for broker status
413413
- 🔀 **Unified API**: Same code works for Kafka, RabbitMQ, NATS, Redis Streams
414414

415-
`python-eventing` uses FastStream for all Kafka/RabbitMQ interactions, giving you a clean, Pythonic API while handling all the low-level complexity.
415+
`messagekit` uses FastStream for all Kafka/RabbitMQ interactions, giving you a clean, Pythonic API while handling all the low-level complexity.
416416

417417
## Setup
418418

@@ -446,8 +446,8 @@ Initialize the outbox repository and event bus at application startup:
446446
```python
447447
from fastapi import FastAPI
448448
from sqlalchemy.ext.asyncio import create_async_engine
449-
from messaging.infrastructure import SqlAlchemyOutboxRepository
450-
from messaging.core import build_event_bus
449+
from messagekit.infrastructure import SqlAlchemyOutboxRepository
450+
from messagekit.core import build_event_bus
451451

452452
app = FastAPI()
453453

@@ -473,8 +473,8 @@ The **core pattern** is the transactional outbox - persist events atomically wit
473473

474474
```python
475475
from fastapi import Depends
476-
from messaging.core import BaseEvent
477-
from messaging.infrastructure import SqlAlchemyOutboxRepository
476+
from messagekit.core import BaseEvent
477+
from messagekit.infrastructure import SqlAlchemyOutboxRepository
478478

479479
# Define domain event
480480
class UserCreated(BaseEvent):
@@ -520,8 +520,8 @@ async def create_user(
520520
For **decoupled architectures** with multiple side effects per event, use the **EventBus** abstraction layer:
521521

522522
```python
523-
from messaging.core import BaseEvent
524-
from messaging.infrastructure import OutboxEventHandler
523+
from messagekit.core import BaseEvent
524+
from messagekit.infrastructure import OutboxEventHandler
525525

526526
# Access EventBus (initialized at startup)
527527
event_bus = request.app.state.event_bus
@@ -551,16 +551,16 @@ await event_bus.dispatch(UserCreated(...))
551551

552552
## Distribution
553553

554-
- PyPI distribution name: `python-eventing`
555-
- Python import package: `messaging`
554+
- PyPI distribution name: `messagekit`
555+
- Python import package: `messagekit`
556556

557557
```python
558558
# Install
559-
pip install python-eventing
559+
pip install messagekit
560560

561561
# Import
562-
from messaging.core import BaseEvent
563-
from messaging.infrastructure import SqlAlchemyOutboxRepository
562+
from messagekit.core import BaseEvent
563+
from messagekit.infrastructure import SqlAlchemyOutboxRepository
564564
```
565565

566566
Services should consume the published package rather than source checkout. Kafka remains shared infrastructure with local producer/consumer clients per service.

coverage.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/confluent-backend-migration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
### Imports Updated
1515
Changed `from faststream.kafka``from faststream.confluent` in:
16-
- `src/messaging/infrastructure/pubsub/broker_config.py`
17-
- `src/messaging/infrastructure/pubsub/kafka_publisher.py`
18-
- `src/messaging/infrastructure/health/outbox_health_check.py`
16+
- `src/messagekit/infrastructure/pubsub/broker_config.py`
17+
- `src/messagekit/infrastructure/pubsub/kafka_publisher.py`
18+
- `src/messagekit/infrastructure/health/outbox_health_check.py`
1919
- `tests/unit/infrastructure/test_kafka_publisher.py`
2020
- `tests/unit/infrastructure/test_fake_broker_contract/test_signature_match.py`
2121

docs/deployment/quickstart-docker-kafka.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Publish events directly to Kafka - no database, no CDC needed.
2222
**Code example**:
2323
```python
2424
from faststream.kafka import KafkaBroker
25-
from messaging.infrastructure.pubsub.kafka_publisher import KafkaEventPublisher
25+
from messagekit.infrastructure.pubsub.kafka_publisher import KafkaEventPublisher
2626

2727
# Create broker and publisher
2828
broker = KafkaBroker("localhost:9092")
@@ -48,7 +48,7 @@ Write events to database in same transaction as business logic, CDC publishes to
4848
```python
4949
from sqlalchemy.ext.asyncio import AsyncSession
5050
from python_outbox_core import OutboxPublisherBase
51-
from messaging.infrastructure.outbox.repository import SqlAlchemyOutboxRepository
51+
from messagekit.infrastructure.outbox.repository import SqlAlchemyOutboxRepository
5252

5353
# In your transaction
5454
async with session.begin():

docs/eventbus/usage-guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ Kafka Publisher → External broker
7676

7777
```python
7878
from fastapi import Depends
79-
from messaging.core import BaseEvent
80-
from messaging.infrastructure import SqlAlchemyOutboxRepository
79+
from messagekit.core import BaseEvent
80+
from messagekit.infrastructure import SqlAlchemyOutboxRepository
8181

8282
class UserCreated(BaseEvent):
8383
event_type: str = "user.created"
@@ -107,7 +107,7 @@ async def create_user(
107107

108108
```python
109109
from fastapi import Request
110-
from messaging.infrastructure import OutboxEventHandler
110+
from messagekit.infrastructure import OutboxEventHandler
111111

112112
@router.post("/users")
113113
async def create_user(data: CreateUserRequest, request: Request):
@@ -146,7 +146,7 @@ async def create_user(data: CreateUserRequest, request: Request):
146146
**Solution**: EventBus dispatches to `OutboxEventHandler`, which persists events in the same database transaction as business data.
147147

148148
```python
149-
from messaging.infrastructure import OutboxEventHandler
149+
from messagekit.infrastructure import OutboxEventHandler
150150

151151
# In service layer
152152
async def create_order(data, session):
@@ -202,7 +202,7 @@ await event_bus.dispatch(OrderPlaced(...))
202202
**Solution**: Use lifecycle hooks to log/trace all dispatches.
203203

204204
```python
205-
from messaging.core import DispatchHooks
205+
from messagekit.core import DispatchHooks
206206

207207
def log_dispatch(trace):
208208
logger.info(
@@ -269,7 +269,7 @@ await service.create_user(data) # EventBus disabled, no DB writes
269269
**Solution**: Implement custom `DispatchBackend`.
270270

271271
```python
272-
from messaging.core import DispatchBackend
272+
from messagekit.core import DispatchBackend
273273
import asyncio
274274

275275
class ParallelDispatchBackend(DispatchBackend):

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
typehints_defaults = "comma"
5050

5151
autoapi_type = "python"
52-
autoapi_dirs = [str(SRC_DIR / "messaging")]
52+
autoapi_dirs = [str(SRC_DIR / "messagekit")]
5353
autoapi_root = "autoapi"
5454
autoapi_add_toctree_entry = True
5555
autoapi_keep_files = False # Don't keep files to avoid stale references

docs/source/consumer-transactions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Consumer transaction management guide
22

3-
**API Reference:** [IdempotentConsumerBase](https://python-eventing.readthedocs.io/en/latest/autoapi/messaging/infrastructure/messaging/kafka_consumer_base/index.html)
3+
**API Reference:** [IdempotentConsumerBase](https://python-eventing.readthedocs.io/en/latest/autoapi/messagekit/infrastructure/messaging/kafka_consumer_base/index.html)
44

55
**Integration Guide:** [Consume idempotently](https://python-eventing.readthedocs.io/en/latest/integration-guide.html#consume-idempotently)
66

@@ -51,8 +51,8 @@ If either fails, both should roll back together.
5151

5252
```python
5353
from faststream.kafka import KafkaBroker
54-
from messaging.infrastructure.messaging.kafka_consumer_base import IdempotentConsumerBase
55-
from messaging.infrastructure.persistence.processed_message_store import SqlAlchemyProcessedMessageStore
54+
from messagekit.infrastructure.messaging.kafka_consumer_base import IdempotentConsumerBase
55+
from messagekit.infrastructure.persistence.processed_message_store import SqlAlchemyProcessedMessageStore
5656

5757
broker = KafkaBroker()
5858

docs/source/cross-service-communication.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Service C (Notification Service)
4646
# service-a/routes.py
4747
from fastapi import FastAPI, Depends
4848
from sqlalchemy.ext.asyncio import AsyncSession
49-
from messaging.infrastructure.outbox import SqlAlchemyOutboxRepository
50-
from messaging.core import BaseEvent
49+
from messagekit.infrastructure.outbox import SqlAlchemyOutboxRepository
50+
from messagekit.core import BaseEvent
5151

5252
app = FastAPI()
5353

@@ -118,7 +118,7 @@ CDC detects new row in `outbox_events` and publishes to **Kafka topic: `user.cre
118118
```python
119119
# service-b/consumers.py
120120
from faststream.kafka import KafkaBroker
121-
from messaging.infrastructure.pubsub.consumer_base import SqlAlchemyProcessedMessageStore
121+
from messagekit.infrastructure.pubsub.consumer_base import SqlAlchemyProcessedMessageStore
122122

123123
broker = KafkaBroker("kafka:9092") # Docker service name
124124

@@ -160,8 +160,8 @@ The bridge service (part of standard architecture) runs the Kafka → RabbitMQ f
160160
```python
161161
# eventing-bridge/main.py (thin wrapper service)
162162
from fastapi import FastAPI
163-
from messaging.main._initialization.bridge_setup import initialize_production_bridge
164-
from messaging.config import settings
163+
from messagekit.main._initialization.bridge_setup import initialize_production_bridge
164+
from messagekit.config import settings
165165

166166
app = FastAPI(title="Eventing Bridge")
167167

@@ -182,7 +182,7 @@ async def startup():
182182
```python
183183
# service-c/consumers.py
184184
from faststream.rabbit import RabbitBroker
185-
from messaging.infrastructure.pubsub.consumer_base import SqlAlchemyProcessedMessageStore
185+
from messagekit.infrastructure.pubsub.consumer_base import SqlAlchemyProcessedMessageStore
186186

187187
rabbit_broker = RabbitBroker("amqp://guest:guest@rabbitmq:5672/")
188188

0 commit comments

Comments
 (0)