跳转到主要内容

一个无依赖的照明脚手架Python工具

项目描述

一个无依赖的脚手架Python工具

功能

  • 轻松建立和创建脚手架

  • 无依赖

  • 独立文件,可使用 python -c "$(curl ...)" 直接执行

用例

  • 非常短的快速启动项目(除了Python之外无需安装任何东西)

使用示例

您可以直接建立脚手架,而无需在您的系统上安装任何东西。

例如,如果您想建立 Python包脚手架 脚手架,请在 终端提示符中粘贴

$ 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包脚手架 脚手架示例。

在这个仓库中

.
├── 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”是一个包含变量列表的字典

  • “ignores”是一个包含要忽略的文件列表的列表

参见

如果您想要更强大的脚手架工具,可以查看mr.bob

有关Python骨架构建工具的更多信息,请参阅此维基页面: https://wiki.python.org/moin/SkeletonBuilderTools

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

echafaudage-0.1.0.tar.gz (21.8 kB 查看哈希值

上传时间

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面