使用bumpversion来自动打标签和管理版本号

用的是这个包: github.com/c4urself/bump2version

基本操作如下:

1. 安装

pip install bumpversion
# poetry add --dev bumpversion

2. 配置

cat .bumpversion.cfg
[bumpversion]
current_version = 1.5.0
commit = True
tag = True

[bumpversion:file:pyproject.toml]
cat pyproject.toml
[tool.poetry]
name = "zhifu"
version = "1.5.0"  # 这里的版本号要跟.bumpxxx.cfg里的一致
description = ""
authors = ["waket <waketzheng@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.8"
fastapi = "^0.63.0"
uvicorn = "^0.13.4"
httpx = "^0.17.0"
redis = "^3.5.3"
tortoise-orm = "^0.16.21"
celery = {extras = ["redis", "pyamqp", "msgpack"], version = "^5.0.5"}
asyncpg = "^0.22.0"
python-dotenv = "^0.15.0"
rich = "^9.13.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2.2"
ipython = "^7.21.0"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

3. 使用

bumpversion patch
# 1.5.0 -> 1.5.1
bumpversion minor
# 1.5.0 -> 1.6.0
bumpversion major
# 1.5.0 -> 2.0.0

### 2024-06-25 补充:

如果用的是Python3.10以上版本,可用fast-dev-cli,无需再配置.bumpversion.cfg

pip install fast-dev-cli
fast bump patch
# fast bump minor
# fast bump major

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值