无依赖关系的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第三方库


热门话题
无法在Netbeans 8.2 JDK8u231中创建java Maven项目(Web应用程序)   java如何以设定的时间间隔生成随机数?   java从socket和inputStream的慢速读取   spring SCORM:Java中基于Web的SCORM播放器   Java将函数传递给方法   java绑定通用服务及其实现和子类型   java如何在运行时从选择列表框中动态选择选项?爪哇硒   java Selenium WebDriver什么是“Selenium客户端和WebDriver语言绑定”   elasticsearch需要elasticsearch高级Java客户端更新ByQueryRequest API帮助   JAVA哈希表查找最大值   WSDL操作中的java soapAction属性为空   java访问封闭类或父类方法的一般方法   eclipse在java中运行带有SeleneTestCase的ANT。lang.NoClassDefFoundError   java Hazelcast不会在节点启动时填充ReplicatedMap   如何在Java中从excel中读取特定行?   html JAVA将本地时间(GMT+8)转换为UTC时间   java将自定义端点添加到Spring数据REST存储库中,并以大摇大摆的方式显示   java计算未来位置