anypubsub
A generic interface wrapping multiple backends to provide a consistent pubsub API.
Usage
Create a pubsub object:
from anypubsub import create_pubsub
pubsub = create_pubsub('memory')
or create a pubsub object from settings:
from anypubsub import create_pubsub_from_settings
pubsub = create_pubsub_from_settings({'anypubsub.backend': 'memory'}, prefix='anypubsub.')
Subscribe to a channel:
subscriber = pubsub.subscribe('a_channel')
you can also subscribe to multiple channels:
subscriber = pubsub.subscribe('a_channel', 'b_channel')
the subscriber is an iterator object that returns the next published message at each loop increment, and blocks until next message is published.
Publish a message to a channel:
pubsub.publish('a_channel', 'hello world!')
message = next(subscriber)
assert message == 'hello world!'
Supported backends
memory
redis
mongodb
amqp (tested with rabbitmq)
Backend specific optional settings
redis:
host: hostname or full redis url, default: localhost port: default 6379 db: default 0 max_connections: connection pool max connections connection_pool: an already created redis-py ConnectionPool
mongodb:
host: hostname or full mongodb url port: mongodb port max-pool-size: connection pool max connections client: an already created pymongo MongoClient database: database used to store messages, default anypubsub collection: collection used to store messages, default anyps_messages collection_size: messages collection size in bytes, default 10MB
Metadata
Release files for anypubsub 0.6
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 | Actions |
|---|---|---|---|---|
| anypubsub-0.6.tar.gz | 6.0 kB | Without provenance | Details for anypubsub-0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| anypubsub-0.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for anypubsub-0.6-py2.py3-none-any.whl |
Total release size: 17.8 kB
Release files / anypubsub-0.6.tar.gz
| Download URL | anypubsub-0.6.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57d48ba8932ae57ec91b386725a0acb23b208228eabd85c5409d8e7bb3c64412
|
|
BLAKE2b-256 checksum How to use checksums |
ecc31c384b30ddfb551de1ca915bc3b5630e4bfe5aeb3838b36199edb95f2e2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / anypubsub-0.6-py2.py3-none-any.whl
| Download URL | anypubsub-0.6-py2.py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7f6e0ade707f1c7b40c08e25a7b0048cd3099e54b4d4a39d73429f000951ada4
|
|
BLAKE2b-256 checksum How to use checksums |
99efa33f2f2e417e861f0516a71f187118aa875eb97e262d23ccac722c2b0a7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for anypubsub 0.6
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.