一个轻量级、多平台的python构建工具,考虑到了jenkins这样的持续集成服务器。

Dovetail的Python项目详细描述


燕尾榫是一个轻量级、多平台的python构建工具 考虑到像jenkins这样的持续集成服务器。


TL;DR

Builds are complex, integrate many tools and sometimes must run on many platforms. Writing good build scripts is hard.

Dovetail helps in all these areas, and is not a rip’n’replace for your existing tools. You can readily automate a build using Dovetail.


构建应用程序不仅仅是运行:

> python setup.py sdist

怎么样:

  • Building binary distributions for several target platforms
  • Building the user documentation and the API docs?
  • Running your unit tests, sometimes using several test frameworks?
  • Installing your application in a clean virtual environment and running user tests?
  • Running code quality tools like Coverage and Pylint?
  • Tagging your code in your DVCS?
  • Uploading the artifacts to a repository? That’s probably at least an Egg, a source distribution, documentation and your web site

如何保证每个人,特别是新的团队成员 以同样的方式建造?

许多团队通过编写脚本来解决这个问题,但这会引发更多的问题:

  • Do you have a lot of scripts lying around, each doing their own thing, and little shared code?
  • Do you have operating system specific scripts that do the same thing, but on different operating systems?
  • Are your scripts reliable and maintainable?

如果您需要在这些方面进行改进,dovetail可以帮助您。燕尾型:

  • Is pure Python, so the build runs everywhere and is maintainable
  • Provides a simple API to externalize many common build requirements
  • There are no new configuration file formats or 4GLs of abstruse XML or other syntaxes
  • Makes it simple to query the build environment and adjust the build appropriately
  • Audits all the build steps and decisions
  • Properly catches build errors and displays the details of what went wrong
  • Makes it terribly easy to automate the build in a tool like Jenkins.

对维护人员来说,一个意想不到的好处是它变得更容易了 在我的ide中构建;我也从命令行获得完全相同的构建。

燕尾榫不能代替Setuptoolsdistutils- 对于创建可分发的 包裹。

功能性

鸽尾构建脚本是标准python脚本函数声明为 在构建中通过装饰它们成为tasks。进一步的装饰声明:

  • Task dependencies, with the same build script or across related files
  • Required packages, which are downloaded and installed if not present
  • Conditions, such as tests on environment variables or the file system.
  • Build directory structure
  • Error conditions, such as a non-zero return or output in stderr.

燕尾榫与许多其他工具一起工作,使构建步骤自动化,并且具有内置的 与Virtualenv集成。任何版本都可以 在路径上的python版本或任何指定的虚拟环境中运行。

鸠尾榫根据需要安装软件包,即使在构建过程中也是如此。这意味着 在复杂的构建中运行一个简单的任务,而不安装所有文档 以及测试包。

示例

下面给出了燕尾型构建脚本的一个小例子。它使用 Sphinx创建项目文档:

from dovetail import task, requires, check_result, call, mkdirs, do_if, IsDir
from os import path
from shutil import rmtree

DOCSOURCE = path.abspath(path.join(path.dirname(__file__), "source"))
BUILD     = path.abspath(path.join(path.dirname(__file__), "..", "build"))

@task                  # Declares the function clean() is a build task
@do_if(IsDir(BUILD))   # Only run if the build directory exists
def clean():
    """Clean the project of all build artifacts"""
    rmtree(BUILD)

@task                  # Declares the function clean() is a build task
@requires('sphinx')    # Ensures the sphinx package is installed
@mkdirs(BUILD)         # Make the build directory if it doesn't exist
@check_result          # Fails the build if sphinx fails
def doc():
    """Builds the Sphinx User documentation"""
    return call("sphinx-build {0} {1}".format(DOCSOURCE, BUILD).split(' '))

生成仅从操作系统命令行运行:

$ dovetail clean doc

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

推荐PyPI第三方库


热门话题
java为什么程序显示空结果?   java应用程序在测试设备上调试时工作正常,但在发布版apk中没有,它没有获得post。来自firebase的类变量   java Android:从主活动按钮确定在listview中选中哪个复选框   在Spring中添加@OneToOne注释时启动ApplicationContext时发生java错误   用JAVA Android实现矩阵计算的最快方法   SpringJava语义有没有更好的编写方法?   java从hashmap中减去两个值后返回最小差值的键?   Java中的静态初始化顺序:Netty 4.0.7的例外   java如何检查用户输入是否为字符串   循环Java计数单词索引   java如何使用以下代码将视频流传输到Android异步Http服务器?   java如何在jtable的所有行中循环   java如何使用maven将unicode插入mysql   java使用安卓加速远程数据检索   java试图模拟麦克风(javax.sound.sampled)   swing SwingWorker从不归还任何东西?(爪哇)   首次在Android Studio上未加载java LibGDX文件   java如何在多个Mysql服务器上设置限制和偏移?   如何防止从java连接到mongodb时登录控制台?