polyvers的库,用于从git monorepos上的标记派生子项目版本。
polyversion的Python项目详细描述
Version: | 0.2.2a1 |
---|---|
updated: | 2018-08-07T13:30:07.616687 |
Documentation: | http://polyvers.readthedocs.io/en/latest/usage-pvlib.html |
repository: | https://github.com/JRCSTU/polyvers |
pypi-repo: | https://pypi.org/project/polyversion/ |
Copyright: | 2018 JRC.C4(STU), European Commission (JRC) |
license: | MIT License |
python 2.7+库需要由polyvers cmd管理的(子)项目在运行时从git派生其版本id。
具体来说,配置文件.polyvers.yaml不被读取- 必须重复任何非默认配置作为函数/方法关键字 调用此API时。
这里只提供了一个非常基本的文档-请咨询polyvers 在上面的链接中提供的文档
注意
只有这个库是(允许的)麻省理工学院授权的,所以它可以被免费出售。 通过任何程序-相应的polyvers命令行工具是 EUPLv1.2下的“copylefted”。
- 使用此库有4种方法:
- 作为setuptools插件
- 通过它的python api(动态版本化您的项目);
- 通过它的裸命令行工具:polyversion (需要安装);
- 通过独立的可执行控制盘:bin/pvlib.run (没有安装,但需要源;行为相同 到polyversion命令)。
- 作为setuptools插件
setuptools用法
当前模块:多版本
polyversion库的功能是setuptools“插件”,并且 添加两个新的setup()关键字以派生子项目版本 从pkg-info或git标记(参见func(polyversion.init_plugin_kw):
- 关键字:polyversion --> (bool | dict)
当一个dict时,它的键大致模拟func中的键(polyversion()), 可以这样使用:
fromsetuptoolsimportsetupsetup(project='myname',version=''# omit (or None) to abort if cannot auto-versionpolyversion={# dict or bool'mono_project':True,# false by default...# See `polyversion.init_plugin_kw()` for more keys.},setup_requires=[...,'polyversion'],...)
- 关键字:polyversion_check_bdist_enabled --> bool
如果为true,则启用bdist check,并启用任何设置命令 (例如bdist_wheel)如果不是从雕刻源运行,则将中止 (即来自release标记)。
若要在不编辑源的情况下启用此检查,请将以下内容添加到 您的$CWD/setup.cfg文件:
[global] polyversion_check_bdist_enabled = true ...
API使用
在您的 myproject.git/myproject/__init__.py文件:
frompolyversionimportpolyversion,polytime# no hack, dependency already installed__version__=polyversion()# project assumed equal to this module-name: 'myproject'__updated__=polytime()...
小费
取决于你的回购协议的versioning scheme(例如你有一个mono项目回购协议, 对于像vX.Y.Z这样的版本标记,必须同时添加两个调用 在kw argmono_project=True上方的func(polyversion.polyversion())。
控制台使用
此库的典型命令行用法(假设您不想安装 完整的polyvers命令工具)如下:
user@host:~/ $ polyversion --help Describe the version of a *polyvers* projects from git tags. USAGE: polyversion [PROJ-1] ... polyversion [-v | -V ] # print my version information user@host:~/ $ polyversion polyversion # fails, not in a git repo b'fatal: not a git repository (or any of the parent directories): .git\n' cmd: ['git', 'describe', '--match=cf-v*'] Traceback (most recent call last): File "/pyenv/site-packages/pvlib/polyversion/__main__.py", line 18, in main polyversion.run(*sys.argv[1:]) File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 340, in run res = polyversion(args[0], repo_path=os.curdir) File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 262, in polyversion pvtag = _my_run(cmd, cwd=repo_path) File "/pyenv/site-packages/pvlib/polyversion/__init__.py", line 106, in _my_run raise sbp.CalledProcessError(proc.returncode, cmd) subprocess.CalledProcessError: Command '['git', 'describe', '--match=cf-v*']' returned non-zero exit status 128. user@host:~/ $cd polyvers.git user@host:~/polyvers.git (dev) $ polyversion polyvers polyversion polyvers: 0.0.2a10 polyversion: 0.0.2a9
独立车轮
使用bash (这些设备在没有安装任何设备的情况下仍然可以工作):
user@host:~/polyvers.git (master) $user@host:~/polyvers.git (master) $ ./bin/pvlib.run polyversion polyversion: 0.0.2a9 user@host:~/polyvers.git (master) $ python ./bin/pvlib.run --help ... user@host:~/polyvers.git (master) $ python ./bin/pvlib.run -m polyversion -v version: 0.0.2a9 user@host:~/polyvers.git (master) $PYTHONPATH=./bin/pvlib.run python -m polyversion -V version: 0.0.2a9 updated: Thu, 24 May 2018 02:47:37 +0300
其余的请参考polyvers项目:https://polyvers.readthedocs.io