跳转到主要内容

专业提升项目版本的库

项目描述

dephell_versioning

travis appveyor MIT License

提升项目版本的库。

可用方案

  • calver
  • comver
  • pep
  • roman
  • romver
  • semver
  • serial
  • zerover

可用规则(及其别名)

  • init -- 初始化版本控制
  • 主要部分
    • major破坏性
    • minor特性
    • patch修复微观
  • 附加部分
    • dev
    • local
    • post
  • 预发布管理
    • prercalphabeta
    • premajor预破坏性
    • preminor预特性
    • prepatch预修复预微观
    • release

dephell项目提升的文档中了解更多关于方案和规则的信息。

安装

PyPI安装

python3 -m pip install --user dephell_versioning

用法

获取可用方案、规则和别名

from dephell_versioning import get_aliases, get_rules, get_schemes
get_schemes()
# frozenset({'roman', 'pep', ..., 'comver'})

get_rules()
# frozenset({'local', 'minor', ..., 'dev', 'preminor'})

get_aliases()
# frozenset({'alpha', 'rc', ..., 'micro', 'breaking'})

# get rules for some scheme:
get_rules(scheme='calver')
# frozenset({'major', 'patch', 'init'})

# get aliases for specific rules:
get_aliases(rules={'major', 'minor'})
# frozenset({'feature', 'breaking'})

提升版本

from dephell_versioning import bump_version

bump_version(version='1.2.3', rule='minor', scheme='semver')
# '1.3.0'

# pass aliase instead of rule:
bump_version(version='1.2.3', rule='feature', scheme='semver')
# '1.3.0'

# start rule from `+` to attach local version number:
bump_version(version='1.2.3', rule='+456', scheme='semver')
# '1.2.3+456'

# for `init` version is optional
bump_version(version='', rule='init', scheme='semver')
# '0.1.0'

在Python文件中提升版本

from dephell_versioning import bump_file
from pathlib import Path

# returns `True` if version was bumped
bump_file(path=Path('dephell_versioning', '__init__.py'), old='0.1.0', new='0.1.1')
# True

# old version is optional: any version will be bumped if old isn't found
bump_file(path=Path('dephell_versioning', '__init__.py'), old='', new='0.1.2')
# True

使用dephell_discover来查询Python项目的当前版本

from dephell_discover import Root
from pathlib import Path
root = Root(path=Path(), name='dephell_discover')

# root.metainfo can be None if project isn't found in the given directory
if root.metainfo:
    print(root.metainfo.version)
# '0.1.2'

项目详情


下载文件

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

源代码分发

dephell_versioning-0.1.2.tar.gz (9.7 kB 查看哈希值)

上传时间 源代码

构建分发

dephell_versioning-0.1.2-py3-none-any.whl (11.7 kB 查看哈希值)

上传时间 Python 3

由以下支持