无依赖关系的lighting scaffolding python工具
echafaudage的Python项目详细描述
无依赖关系的scaffolding python工具
功能:
- 搭设脚手架容易
- 无依赖性
- 可直接使用python -c"$(curl...)" 执行的独立文件
用例:
- 非常简短的快速启动项目(除了python,您不需要安装任何东西)
使用示例
您可以直接安装脚手架,而不必在系统上安装任何东西。
例如,如果您想竖立Python package scaffolding 脚手架然后在终端提示下粘贴它:
$ python -c "$(curl -fsSL https://raw.github.com/harobed/echafaudage/master/echafaudage.py)" -s https://github.com/harobed/python_package_scaffolding/archive/master.zip /tmp/my_new_project
接下来echafaudage问一些问题:
mail : contact@stephane-klein.info version : 0.1.0 package_name : my-project author : Stéphane Klein
现在您的项目位于/tmp/my_new_project/
$ ls /tmp/my_new_project/ bootstrap.py devel-requirements.txt my_project requirements.txt setup.py tests unittest.cfg
您也可以在系统上安装“echafaudage”
$ pip install echafaudage
然后像这样使用echafaudage:
$ echafaudage -s https://github.com/harobed/python_package_scaffolding/archive/master.zip /tmp/my_new_project
您也可以在命令行中直接设置一些变量:
$ echafaudage -s https://github.com/harobed/python_package_scaffolding/archive/master.zip /tmp/my_new_project --vars project_name=my-project,version=1.0
echafaudage用法
$ bin/echafaudage --help Usage: echafaudage [options] -s <scaffolding> [<TARGET>] Arguments: TARGET where scaffolding will be created, by default it is "." (current directory) Options: -s, --scaffolding=<scaffolding> The scaffolding to use, can be a directory path, an archive or archive url. --vars=<variables> Custom variables, e.g --vars hello=world,sky=blue -h --help Show this screen. -v, --verbose --version Example: $ echafaudage -s /path/to/directory/ or $ echafaudage -s my_scaffolding.tar.gz or $ echafaudage -s http://example.com/my_scaffolding.tar.gz
如何创建新的脚手架
首先,你可以看到Python package scaffolding 脚手架示例。
在此存储库中:
. ├── README.rst ├── bootstrap.py ├── devel-requirements.txt ├── requirements.txt ├── scaffolding.json <= scaffolding configuration file ├── setup.py.tmpl <= template file ├── tests │ └── test_basic.py ├── unittest.cfg └── {{package_name_underscore}} <= this folder is renamed with "package_name_underscore" variable value └── __init__.py.tmpl <= template file
{{package_name_underscore}}/__init__.py.tmpl内容:
__version__ = '{{version}}'
scaffolding.json(json格式)配置变量列表:
{ "variables": { "package_name": null, "author": null, "mail": null, "package_name_underscore": { "lambda": "vars['package_name'].replace('-', '_')" }, "version": { "default": "0.1.0" } }, "ignores": [ "README.rst" ] }
- “variables”是带有变量列表的dict
- “忽略”是一个包含要忽略的文件列表的列表
另请参见
如果你想要更强大的脚手架工具,你可以看看mr.bob。
有关python skeleton builder工具的更多信息,请参见此wiki页面:https://wiki.python.org/moin/SkeletonBuilderTools