Skip to main content

Python client for the Serf orchestration tool

Project description

asyncserf is an async Python interface to Serf, the decentralised solution for service discovery and orchestration.

It uses anyio <https://github.com/agronholm/anyio> as its underlying async framework.

PyPI latest version badge Code coverage badge

Installation

asyncserf requires a running Serf agent. See Serf’s agent documentation for instructions.

To install asyncserf, run the following command:

$ pip install asyncserf

or alternatively (you really should be using pip though):

$ easy_install asyncserf

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.

Sending a message is easy:

from asyncserf import serf_client

async with serf_client() as client:
    await client.event('foo', b'bar')

So is receiving:

.. code-block:: python

from asyncserf import serf_client

async with serf_client() as client:
async with client.stream(‘foo’) as stream:
async for resp in stream:

print(resp.payload)

Development

You can run the tests using the following commands:

$ serf agent --tag foo=bar & # start serf agent
$ python3 -mpytest tests

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

asyncserf-0.21.0.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

asyncserf-0.21.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file asyncserf-0.21.0.tar.gz.

File metadata

  • Download URL: asyncserf-0.21.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.21.0 setuptools/52.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.9.2

File hashes

Hashes for asyncserf-0.21.0.tar.gz
Algorithm Hash digest
SHA256 ab9aa1bdf63208193b494f3c664af1278311b740bf5abfc4274981daad2c3ae7
MD5 01d88b741994f2af9cd8ce5a6171b456
BLAKE2b-256 9cb40584606d959ef440f07acce5c9c1cd3df49c8b37cf0e399e56adc6046b07

See more details on using hashes here.

Provenance

File details

Details for the file asyncserf-0.21.0-py3-none-any.whl.

File metadata

  • Download URL: asyncserf-0.21.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.8.2 requests/2.25.1 setuptools/63.2.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.10.5

File hashes

Hashes for asyncserf-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37b03c0ec4c3b3599e4f25a166d15e5ad2249cc1ed40a5804e6ddb1efac8afae
MD5 4d7c3a6dd5836dcda553010d84682286
BLAKE2b-256 bacca7de5f51b14e6c39844ea8ebdc25f2c69777adf52fb92be0d5ed2a21e362

See more details on using hashes here.

Provenance

Supported by

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