我发现跨平台实用程序非常有用
unitils的Python项目详细描述
这是什么?我为什么在乎?
Unitils对我的同事和我自己都非常有用。它们是在大多数类unix操作系统上可能找到的通用实用程序的简化、更改形式。它们是作为命令行实用程序编写的,但也提供了一个python生成器,可以在python中使用,而无需“外壳化”命令。
因为这些实用程序的简化性质以及我们所做的妥协。我们希望把自己从类似的命令中区分出来,这些命令是我们的灵感来源。我们的每个实用程序都在命令的末尾附加“.py”。例如,我们的grep版本可以通过grep.py命令调用。
例如,grep.py就是这样设计的:
$ grep.py -i 'warn' /var/log/*.log
从python中可以这样使用:
from glob import iglob from unitils import grep for match in grep("warn", iglob('/var/log/*.log'), ignore_case=True): print(match)
我为什么要用它?
unitils是一组有用的实用程序,它们被重新编写为简单的 并提供cli和python api。
unitils被写为:
- Fast, everything is an generator (where possible) and strives to be as efficient in both memory and cpu time.
- Tested, Unittests are important and we strive for high test coverage.
- Cross Platform, Written in Python these utilities can run on Windows, Linux and Mac OSx.
- Provides an API to use these utilities in Python, cross-platform and without “shelling out”.
- Open Source, This project is released under the GPLv3
它是如何工作的?
我们针对每个命令创建一个python生成器,生成输出并将其发送到stdout。因此,实际上我们可以直接从python中对许多公共实用程序进行本机、内存高效的访问。然后,我们围绕这个生成器tp包装一个命令行接口,为用户提供一个方便的跨平台实用程序。
我怎么得到它?
要获得最受支持的版本:
$ pip install unitils
要获取最新版本:
$ pip install https://github.com/ilovetux/unitils/archive/master.zip
对于夜总会:
$ pip install https://github.com/ilovetux/unitils/archive/dev.zip
如何运行测试?
您可以克隆存储库并使用以下命令:
$ make test
或者:
$ python setup.py nosetests
一般来说,主分支是pypi上可用的分支。
这和什么兼容?
Unitils经过测试并确认可与
- Python3.5
- Python3.4
- Python3.3
- python 2.7版
- 皮比
unitils应该在python运行的所有平台上工作。
Unitils目前提供的公用事业清单是什么?
- 猫
- cp
- 查找
- grep
- 头部
- ls
- mv
- 观看
- 厕所
- 哪个
名单上有什么要做的?
有关的状态,请参见this issue 我们现在的节目。
我能帮忙吗?
您可以执行所有github类型的操作,在我们的issue tracker或fork中提交一个问题,然后提交一个pull request。如果这些都不吸引你,你可以亲自给我发一封电子邮件,地址是me@ilovetux.com