运行命令的命令行实用程序,如果未安装所需的python包,则安装该包
pypirun的Python项目详细描述
皮皮伦
pypirun命令是一个允许从python包运行python命令行脚本的实用程序,即使它是 未安装。
目录
背景
编写此实用程序是为了允许ci/cd管道模板在Docker容器中运行时能够正常工作,而Docker容器中没有安装所需的python实用程序。
这允许模板在不同的docker容器中继续工作,而不需要安装所需的python包的多余步骤。
安装
可以使用python pip包管理器安装此包。
为了安装这个包,python环境必须具有:
- python 3.6或更新版本
- PIP版本8.1.1或更高版本
- 设置工具40.0.0或更高版本
$ pip install pypirun
用法
usage: pypirun [-h] [--interpreter INTERPRETER] [--debug] [--always_install] package command ...
positional arguments:
package Comma seperated list of packages to install, this list cannot contain spaces
command Command to run
optional arguments:
-h, --help show this help message and exit
--interpreter INTERPRETER Python interpreter to use
--debug Enable debug output
--always_install Install the command even if it exists in the path
Everything on the command line after the package name is executed in an environment with the package installed and on
the PATH. As a result, the package and command must come after the optional arguments.
By default pypirun will run the already installed command from the $PATH in the environment if it is found. The
--always_install flag will force it to install and run the command.
示例
从python serviceping包运行serviceping实用程序
下面将从serviceping包运行命令serviceping -c 1 yahoo.com
:
dhubbard@mac:~$ pypirun serviceping serviceping -c 1 yahoo.com SERVICEPING yahoo.com:80 (72.30.35.10:80).from yahoo.com:80 (72.30.35.10:80): time=65.50 ms --- yahoo.com ping statistics ---1 packages transmitted, 1 received, 0.0% package loss, time 73.038msrtt min/avg/max/dev = 65.50/65.50/65.50/0.00 ms
螺丝刀v4 pypirun命令
pypirun包发布一个名为python/pypirun
的螺丝刀v4共享命令。
如果未安装python,则此命令将设置python,并安装并运行pypirun
命令行实用程序。
下面将使用螺丝刀sd cmd从serviceping包运行命令serviceping -c 1 yahoo.com
:
sd-cmd python/pypirun@latest serviceping serviceping -c 1 yahoo.com
贡献
有关如何参与的信息,请参阅the contributing.md file。我们欢迎问题、问题和请求。欢迎拉取请求。
维护人员
德怀特·哈伯德:dhubbard@verizonmedia.com
许可证
这个项目是根据BSD开源许可的条款授权的。请参阅LICENSE了解完整条款。