trio-serf is an async Python interface to Serf, the decentralised solution for service discovery and orchestration.
It uses trio <https://github.com/python-trio/trio> as its underlying async framework. Previous versions used the anyio <https://github.com/agronholm/anyio> wrapper, thus worked with asyncio, trio, and curio, but this has been discontinued because of issues with error handling.
Installation
trio-serf requires a running Serf agent. See Serf’s agent documentation for instructions.
To install trio-serf, run the following command:
$ pip install trio-serf
or alternatively (you really should be using pip though):
$ easy_install trio-serf
or from source:
$ python setup.py install
Getting Started
These examples require a running async loop. Trio <https://github.com/python-trio/trio> is recommended, though asyncio works too.
from trio_serf import serf_client
async with serf_client() as client:
await client.event('foo', 'bar')
Stream usage:
from trio_serf import serf_client
async with serf_client() as client:
async with client.stream('*') as stream:
async for resp in stream:
print(resp)
Development
You can run the tests using the following commands:
$ serf agent --tag foo=bar & # start serf agent
$ python3 -mpytest tests
Release files for trio_serf 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trio_serf-0.4.0.tar.gz | 30.4 kB | Details |
Release files / trio_serf-0.4.0.tar.gz
| Download URL | trio_serf-0.4.0.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5073428a554b598c549c7f29d737002a36d4a0ecd3865733f1681124a315f39d
|
|
BLAKE2b-256 checksum How to use checksums |
a28ddeafd4937e63e536289f6ebf16cea303594aa45b287fdb050b53ecebfdf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.7
|