强大的 Python 任务自动化工具
invoke 是从著名的远程部署工具 Fabric 中分离出来的,它与 paramiko 一起是 Fabric 的两大最核心的基础组件。
文档:
- PyPI: https://pypi.org/project/invoke/
- 文档:http://docs.pyinvoke.org/
- Github: https://github.com/pyinvoke/invoke
安装
pip install invoke
代码实例
tasks.py
# -*- coding: utf-8 -*-
from invoke import task
@task
def hello(c):
print("Hello world!")
@task
def greet(c, name):
c.run(f"echo hi {name}")
运行
$ inv -l
$ inv hello
$ inv greet -n Tom
参考 强大的 Python 任务自动化工具!invoke 十分钟入门指南