无依赖关系的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}}'
扩展名为.tmpl的文件是模板文件。
模板文件由带有变量的tempita模板引擎解析 传递到echafaudage
目标文件夹中的.tmpl扩展被剥离。

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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Intellij新项目JDK不可用   JAVA静态块执行了多少次?   java通过JCheckBox更改文本字段输入的字体颜色   java在星期几文本字段中输入值   java RichFaces 4.2日历。如何通过JavaScript设置日历的输入字段?   java在javafx中注册鼠标处理程序,但处理程序不是内联的   java将jchararray分配给常量unsigned char   在安卓4.4中注意到java奇怪的圆形浮动动作按钮吗?   java中用于解决8个难题的合适的树类是什么   为什么Java在我的Linux服务器上使用了如此多的内存?   java从多个推荐列表中提取顶级推荐   “426写入网络流失败。”尝试使用Java的URL类连接到FTP站点时收到   java如何在没有Gradle的情况下使用IntelliJ打开项目?   java如何在线程完成后使For循环继续?   java使用定制jackson ObjectMapper定制Spring引导序列化过程   java NativeActivity不会显示在屏幕上   如何使用Java中的EditorConfig在IntelliJ IDEA中关闭rightparen自己的行?   java从字符串中删除字母数字单词   Intellij IDEA 13.1中的maven Java编译错误