跳转到主要内容

Serf编排工具的Python客户端

项目描述

trio-serf是Serf(一个用于服务发现和编排的去中心化解决方案)的异步Python接口。

它使用trio <https://github.com/python-trio/trio>作为其底层的异步框架。之前的版本使用了anyio <https://github.com/agronholm/anyio>包装器,因此与asynciotriocurio兼容,但由于错误处理问题,这一功能已被取消。

PyPI latest version badge Code coverage badge

安装

trio-serf需要一个正在运行的Serf代理。有关说明,请参阅Serf代理文档

要安装trio-serf,请运行以下命令

$ pip install trio-serf

或者(尽管如此,您真的应该使用pip)

$ easy_install trio-serf

或者从源码

$ python setup.py install

入门指南

以下示例需要运行异步循环。推荐使用Trio <https://github.com/python-trio/trio>,尽管asyncio也可以使用。

from trio_serf import serf_client

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

流使用

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)

开发

您可以使用以下命令运行测试

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

项目详情


下载文件

下载适合您平台的应用程序。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

trio_serf-0.4.0.tar.gz (30.4 kB 查看哈希值)

上传时间:

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面