跳转到主要内容

又一个yaml运行器。

项目描述

Chamallow

...

安装

...

仅限本地使用

...

(venv)$ pip install chamallow

分布式使用

...

(venv)$ pip install chamallow[zmq]

函数分发

...

从YAML

...

# funcs.py
def ping(a, k=None):
    return f"{a} and {k}"


def pong(a):
    print(a)

...

# demo.yml
ping:
  name: "funcs.ping"
  args:
    - "foo"
  kwargs:
    k: "bar"
  tags:
    - "foo"
pong:
  name: "funcs.pong"
  args:
    - _from: "ping"

...

(venv)$ CHAMALLOW_TAGS=foo chamallow demo.yml
foo and bar

使用装饰器

...

# demo.py
from chamallow import engine, flow

@flow(tags=("foo",))
def ping(a, k=None):
    return f"{a} and {k}"


@flow()
def pong(a):
    print(a)
    return True


if __name__ == "__main__":
    engine.start()
    assert pong(ping("foo", k="bar")).result() is True
    engine.stop()

...

(venv)$ CHAMALLOW_TAGS=foo python demo.py
foo and bar

黑客攻击

...

命令行界面

...

(venv)$ chamallow

Docker

...

$ docker-compose up -d
$ docker-compose exec chamallow bash -c "chamallow examples/simple.yml"
$ docker-compose exec chamallow-client bash -c "cat simple.csv simple.json"
foo;bar
xxx;YYY
{
  "foo": "xxx",
  "bar": "YYY"
}

设置

  • 地址
  • CACHE_TTL
  • 连接端口
  • DEBUG
  • LOCAL
  • 日志格式
  • POLLING_INTERVAL
  • 客户端数量
  • 远程客户端数量
  • 标签

贡献

...

代码风格检查

...

(venv)$ pip install chamallow[lint]
(venv)$ pre-commit run --all-files

测试

...

(venv)$ pip install chamallow[test]
(venv)$ CHAMALLOW_LOCAL=True pytest tests/

许可证

MIT

项目详情


下载文件

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

源分布

chamallow-0.1.1.tar.gz (13.2 kB 查看哈希)

上传时间

由以下机构支持