Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MessagePublisher
✓ from csrd.message import MessagePublisher
✗ from csrd_message import MessagePublisher
Use dot notation with the package root 'csrd.message', not the pypi name.
MessageConsumer
✓ from csrd.message import MessageConsumer
✗ from csrd.message.consumer import MessageConsumer
Direct import from top-level csrd.message is preferred; submodule may change.
RabbitMQPublisher
✓ from csrd.message.backends.rabbitmq import RabbitMQPublisher
✗ from csrd.message.rabbitmq import RabbitMQPublisher
Backend classes live under csrd.message.backends.
Basic RabbitMQ publisher setup.
import os
from csrd.message import MessagePublisher
from csrd.message.backends.rabbitmq import RabbitMQPublisher
publisher = RabbitMQPublisher(
host=os.environ.get('RABBITMQ_HOST', 'localhost'),
port=int(os.environ.get('RABBITMQ_PORT', '5672'))
)
# Alternatively, use the generic publisher:
# publisher = MessagePublisher(backend='rabbitmq', host='localhost')
async def main():
await publisher.connect()
await publisher.publish('my.routing.key', {'data': 'hello'})
await publisher.close()
# Run with asyncio.run(main())
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'csrd.message'
Using hyphens in package name (csrd-message) instead of dots.
fixImport as 'csrd.message' (dots).
AttributeError: module 'csrd.message' has no attribute 'publish'
Trying to use package-level function that doesn't exist; must instantiate a publisher first.
fixCreate a Publisher instance and call its .publish() method.
RuntimeError: Event loop is closed
Running async code without a proper event loop (e.g., in a script without asyncio.run).
fixUse asyncio.run(main()) to execute async functions.
Upgrade
Version history
0.5.28latest on PyPI · released May 18, 2026
Audit
Dependencies
No dependency data recorded yet.