在travis ci`.travis.yml`文件和tox`tox.ini`文件之间转换
panci的Python项目详细描述
对于Python项目,获取一个.travis.yml文件(Travis CI)并输出 tox.ini文件(Tox)。反之亦然。
为什么叫这个名字?
“panci”这个名字是对John MacFarlane优秀的pandoc的敬意。 我已经用“ci”代替了“doc”;“ci”代表持续集成,这是一个广义的术语,用来表示Travis CI和Tox对您有什么帮助。
安装
使用pip:
pip install panci
示例
travis到tox
假设我们有以下.travis.yml:
language:pythonpython:-2.6-2.7-3.2-pypyscript:python setup.py test
如果我们运行:
panci --to=tox .travis.yml
然后我们得到:
# Tox (http://tox.testrun.org/) is a tool for running tests# in multiple virtualenvs. This configuration file will run the# test suite on all supported python versions. To use it, "pip install tox"# and then run "tox" from this directory.[tox]envlist=py26, py27, py32, pypy[testenv]commands=python setup.py test
毒性到特拉维斯
假设我们有以下tox.ini:
[tox]envlist=py26, py27, py33, pypy[testenv]commands=py.testdeps=pytest
如果我们跑:
panci tox.ini
然后我们得到:
language:pythonenv:-TOXENV=py26-TOXENV=py27-TOXENV=py33-TOXENV=pypyinstall:-travis_retry pip install tox==1.6.1script:-travis_retry tox
panci tox快速启动
如果我们跑:
panci-tox-quickstart
然后会问您一些问题:
This utility will ask you a few questions and then generate a simple tox.ini file to help get you started using tox. Please enter values for the following settings (just press Enter to accept a default value, if one is given in brackets). > Test your project with py24 (Y/n) [Y]: n > Test your project with py25 (Y/n) [Y]: n > Test your project with py26 (Y/n) [Y]: > Test your project with py27 (Y/n) [Y]: > Test your project with py30 (Y/n) [Y]: > Test your project with py31 (Y/n) [Y]: > Test your project with py32 (Y/n) [Y]: > Test your project with py33 (Y/n) [Y]: > Test your project with pypy (Y/n) [Y]: > Test your project with jython (Y/n) [Y]: n What command should be used to test your project -- examples: - python setup.py test - nosetests package.module - trial package.module > Command to run to test project [{envpython} setup.py test]: What dependencies does your project have? > Comma-separated list of dependencies [ ]: requests,nose Creating file tox.ini. Finished: A tox.ini file has been created. Execute `tox` to test your project.
然后,一个tox.ini文件被弹出,其中包含:
# Tox (http://tox.testrun.org/) is a tool for running tests# in multiple virtualenvs. This configuration file will run the# test suite on all supported python versions. To use it, "pip install tox"# and then run "tox" from this directory.[tox]envlist=py26, py27, py30, py31, py32, py33, pypy[testenv]commands={envpython} setup.py testdeps= requests nose
关于panci-tox-quickstart的注意事项:我还将长期致力于获得 tox-quickstart命令合并到tox中。见this pull request
支持
有关问题、评论和建议,请使用GitHub Issues。