klak以python的易用性和click的强大功能提供了项目makefile的通用性。
klak的Python项目详细描述
克拉克
Klak provides the ergonoics of a project Makefile with the ease of Python and power of Click.
目录
背景
makefile提供了一个简单的接口make <command>
,非常适合自动化重复的项目任务。然而,makefile语法是过时的、容易出错的,不适合构建现代的、有用的命令行接口。
另一方面,python有很好的语法,对于脚本编写来说,great。当python与Click一起构建现代的、有用的命令行接口时,很容易!
有没有一种方法可以将python的强大功能结合起来,并点击进入“makefile-like”体验?
输入klak。
Klak公开了一个入口点-klak
,它自动加载一个名为clickfile的普通Python文件100%。所有cli都是使用标准的python和click构建的,所有命令都可以通过:klak <command>
获得(请参见Usage)。
有什么好处?
Klak的目的是为自动化重复的项目任务提供一个方便、单一的文件体验。它不打算,也永远不会打算替换make或makefile。
安装
稳定释放
# NOTE: This is the recommended method of installation.
pip install klak
来源
Klak uses Poetry to manage depdencies and distribution (in lieu of setuptools).
# NOTE: Clone the public repository git clone git://github.com/aubricus/klak # NOTE: or download the tarball curl -OL https://github.com/aubricus/klak/tarball/master # NOTE: Once the source is downloaded poetry install
用法
要开始使用klak,请创建一个clickfile。这里有一个简单的clickfile开始:
"""Example Clickfile.NOTE: Set your editor's language mode to Python to enable syntax highlighting! :^)"""importloggingimportclickfromklak.cliimportclilog=logging.getLogger("Clickfile")# -------------------------------------# Examples# -------------------------------------# Example: Add a command.@cli.command()@click.argument("name")defgreet(name):"""Greet someone."""click.secho(f"Hello, {name}")# Example: Add a group and sub-command.@cli.group()defhumans():"""Humans command group."""pass@humans.command(name="count")defhumans_count():"""Count all the humans."""click.secho("Over 9000!!!")
note:您还可以将命令组织到同一目录中的python包中。见Klak/Pull/229。
一旦clickfile就绪,就可以通过klak
访问命令。
$ klak --help
支架
这个项目是我在自己的时间里保持的爱好/激情项目。
Python
- Python3.5+
操作系统
- Linux☆
- macos `
- Windows(有志愿者吗?)
维护人员
贡献
接受减贫战略!
请注意,如果编辑自述文件,请遵循standard-readme规范。
许可证
MIT © 2018, 2019 aubricus@gmail.com