跳转到主要内容

eventstore的事件激活器组件

项目描述

Build Status

atomicpuppy

eventstore的事件激活器组件,用Python编写

简短且基本无用的快速入门

# config.yaml
atomicpuppy:
    host: localhost
    port: 2113
    # each stream will be polled by a separate async http client
    streams:
        - stream_a
        - stream_b
        - stream_with_a_#date#
    # the counter keeps track of which messages have been processed
    counter:
        redis:
            host: localhost
            port: 6379
# main.py
# AtomicPuppy uses asyncio coroutines for concurrent IO
import asyncio
import logging
import signal
from atomicpuppy import AtomicPuppy

# AtomicPuppy needs a callback to pass you messages.
def handle(msg):
  print(msg)

# Config is read from yaml files.
ap = AtomicPuppy('config.yaml', handle)
loop = asyncio.get_event_loop()

# to kill the puppy, call stop()
def stop():
    logging.debug("SIGINT received, shutting down")
    ap.stop()

loop.add_signal_handler(signal.SIGINT, stop)

# and to start it call start.
loop.run_until_complete(ap.start())

运行测试

提供了一个 tox.ini 文件,用于使用不同版本的Python运行测试。

要运行测试

  1. 请确保已安装 Python 3.6、3.7、3.8、3.9 和 3.10 的头文件(对于 Ubuntu,请参考 https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
  2. 从存储库根目录运行 pip install -r test-requirements.txt
  3. 从存储库根目录运行 tox

使用 pyenv 在 Mac 上准备和运行测试

安装 pyenv 和 pyenv-virtualenv 以及 Python 版本

brew install pyenv pyenv-virtualenv

将以下行添加到您的 .zshrc 文件中(请检查最新的 pyenv 文档)

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv install 3.6.15
pyenv install 3.7.12
pyenv install 3.8.12
pyenv install 3.9.9
pyenv install 3.10.1

检查最新版本,安装每个主版本的最新次要版本。

创建一个虚拟环境

pyenv virtualenv 3.10.1 atomicpuppy
pyenv activate atomicpuppy
pip install tox-pyenv
pip install -r test-requirements.txt

运行测试

pyenv local atomicpuppy 3.6.13 3.7.10 3.8.10 3.9.5

tox

关于 Python 版本

Python 3.4 中存在一个 asyncio 的 bug,该 bug 已在其他版本中修复。这是 bug 报告:https://bugs.python.org/issue23812 因此,我们已停止支持 Python 3.4,并建议使用 Python 3.7。

项目详情


下载文件

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

源代码分发

AtomicPuppy-1.5.6.tar.gz (40.3 kB 查看散列

上传时间 源代码

构建分发

AtomicPuppy-1.5.6-py3-none-any.whl (29.4 kB 查看散列

上传时间 Python 3

由以下支持

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