APubSub
Simple, single-purpose message service implementation.
Installation
Python versin 3.7+ required
Just install it with pip: pip install apubsub
Usage
from apubsub import Service
service = Service()
# Note that service is started in stand-alone process
# so start it as early as possible to minimize resource pickling*
service.start()
class Klass:
def __init__(self):
self.sub = service.get_client()
await self.sub.start_consuming() # subscriber should be started
self.pub = service.get_client() # if used only as publisher, it is not required
async def do_smth(self):
data = await self.sub.get(.1) # fetch received data with timeout
if data is None:
print("No data received by subscriber")
return
print(data)
async def do_smth_else(self):
msg = "some string data"
await self.pub.publish("topic", msg)
async def use_iter_get(self):
async for data in self.sub.get_iter():
print(f"Data received: {data}")
Check out more examples in tests
Metadata
Release files for apubsub 0.2.5
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 |
|---|---|---|---|---|
| apubsub-0.2.5.tar.gz | 7.4 kB | Without provenance | Details for apubsub-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apubsub-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for apubsub-0.2.5-py3-none-any.whl |
Total release size: 16.0 kB
Release files / apubsub-0.2.5.tar.gz
| Download URL | apubsub-0.2.5.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff18a0e6451caa0bdd0c0a40a7ee78922167b7b6e524419ba5d15932285f104b
|
|
BLAKE2b-256 checksum How to use checksums |
de4841317e21aa94cae1ac49a91525692c8c1f1fc0f97f76762b2753ea8f04eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.2 CPython/3.7.6 Linux/5.3.0-1029-gcp
|
Release files / apubsub-0.2.5-py3-none-any.whl
| Download URL | apubsub-0.2.5-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64808287f9df1f7972a84f7256efee743a6c2ff1b14470dbc06b203946fa01e1
|
|
BLAKE2b-256 checksum How to use checksums |
c2cc88a92481363465d3bc810423f6bb5e23e416629c609811e0c65ee5027fbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.2 CPython/3.7.6 Linux/5.3.0-1029-gcp
|
Security for apubsub 0.2.5
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.