轻量级python构建工具。

vulcan-builder的Python项目详细描述


Build Status

Vulcan生成器

这个项目是由Raghunandan Rao开发的。我们将为 原始RAGS/PYNT回购协议。

vulcan builder通过一个轻量级、简洁的 python devops工具。我们将在最初的基础上发展我们自己的改进 这里是rags/pynt repo,并发布对原始repo的改进。

这是一个exr开源项目。

python构建的pynt。

功能

  • 易学。
  • 构建任务只是python的功能。
  • 管理任务之间的依赖关系。
  • 自动生成命令行界面。
  • rake样式的参数传递给任务
  • 支持Python2.7和Python3.x
  • 异步任务

TOdo功能

  • 其他任务计时报告
  • 调试模式

安装

您可以从python包索引(pypi)或 从源头上。

使用pip

$ pip install vulcan-builder

使用简易安装

$ easy_install vulcan-builder

示例

构建脚本是用纯python编写的,vulcan builder负责 管理任务之间的任何依赖关系并生成命令行 接口。

编写构建任务非常简单,您只需要知道@task 装饰工。任务只是用 @task()装饰器。依赖项也用@task()指定。 可以使用@task(ignore=True)忽略任务。禁用任务 是一个有用的特性,可以在您有一个任务 许多其他任务都依赖于,您希望快速将其从 所有依赖任务的依赖链。

build.py

#!/usr/bin/pythonimportsysfromvulcan.builderimporttask@task()defclean():'''Clean build directory.'''print'Cleaning build directory...'@task(clean)defhtml(target='.'):'''Generate HTML.'''print'Generating HTML in directory "%s"'%target@task(clean,ignore=True)defimages():'''Prepare images.'''print'Preparing images...'@task(html,images)defstart_server(server='localhost',port='80'):'''Start the server'''print'Starting server at %s:%s'%(server,port)@task(start_server)#Depends on task with all optional paramsdefstop_server():print'Stopping server....'@task()defcopy_file(src,dest):print'Copying from %s to %s'%(src,dest)@task()defecho(*args,**kwargs):printargsprintkwargs# Default task (if specified) is run when no task is specified in the command line# make sure you define the variable __DEFAULT__ after the task is defined# A good convention is to define it at the end of the module# __DEFAULT__ is an optional member__DEFAULT__=start_server

运行vulcan生成器任务

命令行界面和帮助将自动生成。任务 描述是从函数docstrings中提取的。

$ vb -h
usage: vb [-h][-l][-v][-f file][task [task ...]]

positional arguments:
  task                  perform specified task and all its dependencies

optional arguments:
  -h, --help            show this help message and exit
  -l, --list-tasks      List the tasks
  -v, --version         Display the version information
  -f file, --file file  Build file to read the tasks from. Default is
                        'build.py'
$ vb -l
Tasks in build file ./build.py:
  clean                       Clean build directory.
  copy_file
  echo
  html                        Generate HTML.
  images           [Ignored]  Prepare images.
  start_server     [Default]  Start the server
  stop_server

Powered by vulcan-builder - A Lightweight Python Build Tool.

vulcan builder负责处理任务之间的依赖关系。在 以下案例启动服务器依赖于clean、html和图像生成 (忽略图像任务)。

$ vb #Runs the default task start_server. It does exactly what "vb start_server" would do.
[ example.py - Starting task "clean"]
Cleaning build directory...
[ example.py - Completed task "clean"][ example.py - Starting task "html"]
Generating HTML in directory "."[ example.py - Completed task "html"][ example.py - Ignoring task "images"][ example.py - Starting task "start_server"]
Starting server at localhost:80
[ example.py - Completed task "start_server"]

任务名称的前几个字符足以执行任务, 只要部分名称是明确的。可以指定多个 要在命令行中运行的任务。再次获取依赖项 关心。

$ vb cle ht cl
[ example.py - Starting task "clean"]
Cleaning build directory...
[ example.py - Completed task "clean"][ example.py - Starting task "html"]
Generating HTML in directory "."[ example.py - Completed task "html"][ example.py - Starting task "clean"]
Cleaning build directory...
[ example.py - Completed task "clean"]

“html”任务依赖项“clean”只运行一次。但是干净可以 稍后再显式运行。

vb任务可以从命令行接受参数。

$ vb "copy_file[/path/to/foo, path_to_bar]"[ example.py - Starting task "clean"]
Cleaning build directory...
[ example.py - Completed task "clean"][ example.py - Starting task "copy_file"]
Copying from /path/to/foo to path_to_bar
[ example.py - Completed task "copy_file"]

vb也可以接受关键字参数。

$ vb start[port=8888][ example.py - Starting task "clean"]
Cleaning build directory...
[ example.py - Completed task "clean"][ example.py - Starting task "html"]
Generating HTML in directory "."[ example.py - Completed task "html"][ example.py - Ignoring task "images"][ example.py - Starting task "start_server"]
Starting server at localhost:8888
[ example.py - Completed task "start_server"]

$ vb echo[hello,world,foo=bar,blah=123][ example.py - Starting task "echo"]('hello', 'world'){'blah': '123', 'foo': 'bar'}[ example.py - Completed task "echo"]

组织生成脚本

您可以将构建文件分解为模块并简单地导入它们 在主生成文件中。

fromdeploy_tasksimport*fromtest_tasksimportfunctional_tests,report_coverage

贡献者/贡献者

如果您想进行更改,回购协议位于 https://github.com/exrny/vulcan-builder。你需要 pytest运行测试

$ ./vb t

如果你能提高一次pull request那就太好了 你完了。

如果您发现任何错误或需要新功能,请在 issues section的 Github回购协议。

许可证

vulcan builder是根据MIT license

更改

0.1.0-04/02/2018

  • 初始提交

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

推荐PyPI第三方库


热门话题
java如何获取所有链接并使用SeleniumWebDriver逐个单击这些链接   java中数组列表的arraylist移位元素   java如何存储具有不同类型参数的元素   java不能使用List<Future<?>>当从不同位置调用时,在方法参数中   java我应该如何修复代码以避免测试代码出错?   安卓 PreferenceFragment java。lang.RuntimeException   java在运行emulator时发现错误   java取消多个AsyncTask回调的有效方法是什么?如果中途满足条件,这些回调将在将来返回?   有没有办法在运行时将方法动态分配给Java类?   java如何将propertyfile与GlassFish一起使用   如何在PHP中使用bcrypt对密码进行哈希处理?   Java和UDP web服务器   java JPA允许EntityListeners执行JPA操作吗?   java执行do while语句时不会产生错误   java无法在edittext中显示数据库中的数据   java Tomcat中活动会话的数量   java在何处使用@SuppressWarnings(“requestfactory”)   netty连接中的java HornetQ异常