Skip to main content

A generic interface wrapping multiple backends to provide a consistent pubsub API.

Project description

https://travis-ci.com/theruziev/aio_pubsub.svg?branch=master https://codecov.io/gh/theruziev/aio_pubsub/branch/master/graph/badge.svg

A generic interface wrapping multiple backends to provide a consistent pubsub API.

Installation

pip install aio-pubsub

Usage

To use it, you need to implement your pubsub implementation from interfaces or use backends from aio_pubsub.backends package

from aio_pubsub.backends.memory import MemoryPubSub
pubsub = MemoryPubSub()
# Create subscriber
subscriber = await pubsub.subscribe("a_chan")

# Push message
await pubsub.publish("a_chan", "hello world!")
await pubsub.publish("a_chan", "hello universe!")

# And listening channel
try:
    async for message in subscriber:
        print(message, flush=True)
except KeyboardInterrupt:
    print("Finish listening")

Supported backends

Disclaimer: I would not advise you to use this backend, because it is shown only for testing purposes. Better develop your own implementation.

  • memory

  • redis

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aio_pubsub-0.2.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

aio_pubsub-0.2.0-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file aio_pubsub-0.2.0.tar.gz.

File metadata

  • Download URL: aio_pubsub-0.2.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.3

File hashes

Hashes for aio_pubsub-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4beeaf3916e4dfea2a4df79f352e971562c07fe2b0c8863c353615fc54fa6798
MD5 235a1b61d9aa46ce2df832b4c782c549
BLAKE2b-256 04ed6eb2934acf3662e4b060746b970a20fca641321c42e685d6427a6777a39b

See more details on using hashes here.

File details

Details for the file aio_pubsub-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: aio_pubsub-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.3

File hashes

Hashes for aio_pubsub-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dc37841f0f8e47e552d150a0d5bf2dd79767bbd1ec904fb6d578fb3a325a6210
MD5 9c3f525b1d0ea6b3eb8607132406b0bd
BLAKE2b-256 c71ee5d3a08a65e23a5c6fafb12ab7787494f38e2085fdc67b74802c7e0ff35f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page