一个为poetry提供的插件,允许您使用pyinvoke执行tasks.py中定义的脚本。受poetry-exec-plugin启发。
项目描述
poetry-pyinvoke-plugin
一个为poetry提供的插件,允许您调用tasks.py
文件中的命令,并将任务委托给pyinvoke
。
深受poetry-exec-plugin项目上keattang的工作的启发。
安装
安装需要poetry 1.6.0+。要安装此插件,请运行
pip install poetry-pyinvoke-plugin
# OR
poetry self add poetry-pyinvoke-plugin
有关安装插件的其它方法的详细信息,请参阅poetry文档。
快速入门
有关如何设置tasks.py
文件的详细信息,请参阅配置。
列出所有任务
poetry inv -- --list
运行任务
poetry invoke lint
# OR
poetry inv lint
用户指南
配置
tasks.py
from invoke import task
@task
def lint(c):
c.run("flake8")
c.run("black --check .")
命令行使用
快速入门
然后
poetry inv -- --list
示例输出
Invoke: invoke --list
Available tasks:
build Build wheel.
format Autoformat code for code style.
greeting Example task that takes an argument for testing purposes.
lint Linting and style checking.
test Run test suite.
运行任务
poetry invoke lint
# OR
poetry inv lint
您可以使用poetry invoke
或poetry inv
。本文档的其余部分将使用poetry inv
。
详细命令使用
列出所有任务
此操作使用--
将参数断开连接,并将剩余参数传递给invoke
。
命令
poetry inv -- --list
示例输出
Invoke: invoke --list
Available tasks:
build Build wheel.
format Autoformat code for code style.
greeting Example task that takes an argument for testing purposes.
lint Linting and style checking.
test Run test suite.
运行任务
命令
poetry inv lint
示例输出
Invoke: invoke lint
All done! ✨ 🍰 ✨
3 files would be left unchanged.
Skipped 3 files
Success: no issues found in 2 source files
带有参数的任务
单个位置参数
命令
poetry inv greeting Loki
示例输出
Invoke: invoke greeting Loki
Hello Loki, from Sylvie
命令
poetry inv greeting -- Loki
示例输出
Invoke: invoke greeting Loki
Hello Loki, from Sylvie
命名参数
命令
poetry inv greeting -- --name Loki
示例输出
Invoke: invoke greeting --name Loki
Hello Loki, from Sylvie
命令
poetry inv greeting -- -n Loki
示例输出
Invoke: invoke greeting -n Loki
Hello Loki, from Sylvie
多个命名参数
命令
poetry inv greeting -- --name Loki --other Thor
示例输出
Invoke: invoke greeting --name Loki --other Thor
Hello Loki, from Thor
命令
poetry inv greeting -- -n Loki -o Thor
示例输出
Invoke: invoke greeting -n Loki -o Thor
Hello Loki, from Thor
任务帮助
此操作使用--
将参数断开连接,并将剩余参数传递给invoke
。它还在task
命令之前使用--help
来获取其帮助信息。
命令
poetry inv -- --help greeting
示例输出
Invoke: invoke --help greeting
Usage: inv[oke] [--core-opts] greeting [--options] [other tasks here ...]
Docstring:
Example task that takes an argument for testing purposes.
Options:
-n STRING, --name=STRING
-o STRING, --other=STRING
插件帮助
命令
poetry inv --help
示例输出
Description:
Delegate out to pyinvoke tasks specified in your tasks.py file
Usage:
inv [options] [--] <cmd> [<arguments>...]
Arguments:
cmd The command to run from your tasks.py.
arguments Additional arguments to append to the command.
Invoke帮助
此操作使用--
将参数断开连接,并将剩余参数传递给invoke
。
命令
poetry inv -- --help
示例输出
Invoke: invoke --help
Usage: inv[oke] [--core-opts] task1 [--task1-opts] ... taskN [--taskN-opts]
发布
要发布新版本,请从main
创建一个发布版本(在拉取请求之后)。
贡献
在任何时候,您都有权力分叉此项目,根据您的需要进行更改,然后
pip install https://github.com/user/repository/archive/branch.zip
这样您可以在中间或甚至在内部运行您自己的自定义分叉,只需将此项目作为起点即可。这是完全可以接受的。
但是,如果您想将您的更改贡献回来,那么请打开“跨分叉”的拉取请求。
一旦您的更改合并并发布,您就可以恢复到pip安装此包的规范版本。
如果您不确定如何进行更改或是否应该投入时间和精力,那么请打开一个Issue,我们可以讨论并分类问题。
关闭
poetry_pyinvoke_plugin-0.5.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d1b473ce5f35fe9278cbd5c9841ab1ea963e5fa3b2bfb0a7edbfcf3066c85e00 |
|
MD5 | 1633d387be1007d7815ecb91d670ee83 |
|
BLAKE2b-256 | 1f6e2ef3d6a6b3d74d9ac86d35f936791e4fb2731f4483e299e2107deb2008db |
关闭
poetry_pyinvoke_plugin-0.5.0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 06284fc347aaf9b15e0a6f22c74e4f23df779da0457321f822172d47ef062fc8 |
|
MD5 | dc210fde80cb4f77642c844fd5bcb798 |
|
BLAKE2b-256 | c3c28b958a4560c88ec1831752946b27b5323c835318cd17dbcacea82a42d39e |