Version bump tries to bump all matching of `version =` in pyproject.toml
See original GitHub issueThe problem
With version 7.3.0:
In pyproject.toml, the version of the main package is defined as version = 1.2.3
but some dependencies can be defined as such pyarrow = {version = "0.17.0", extras = [ "pandas" ] }
and then semantic release is either bumping both version =
the the computed version or trowing an error such as:
semantic-release version --patch
Creating new version
error: found conflicting versions: '1.2.3', '0.17.0'
Expected behavior
semantic release only bump the root version of the package and nothing in the dependencies section.
Additional context
Here is an example of pyproject.toml that you can use to reproduce
[tool.poetry]
name = "potatoes"
version = "1.2.3"
description = "I love potatoes"
authors = ["Potatoes <potatoes@potatoes.com>"]
[tool.poetry.dependencies]
python = "^3.8"
pyarrow = {version = "0.17.0", extras = [ "pandas" ] }
[tool.semantic_release]
version_variable = "pyproject.toml:version"
upload_to_pypi = false
commit_message = "Version generated by python-semantic-release [ci skip]"
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
bump is also changing dependency versions in pyproject.toml ...
and the version of the dep matches the version of the project, then bump will change both versions. Is it possible to specify...
Read more >Bump up version in Github workflow won't change the code
I moved this function to workflow and it won't change the version string at all!
Read more >poetry-bumpversion - PyPI
The poetry version command only updates version in pyproject.toml file. ... Bumping version from 0.5.0 to 0.5.1 poetry-bumpversion: processed file: ...
Read more >Poetry - The Blue Book
poetry saves all the information in the pyproject.toml file, including the project ... If you pass an argument, it will bump the version...
Read more >Configuration — python-semantic-release 7.32.2 documentation
pyproject.toml file in a [tool.semantic_release] section ... Anything MAY change at any time. ... If you do not want to bump version to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I suggest we change the regular expression for
version_variable
to only match at the start of a line:https://github.com/relekang/python-semantic-release/blob/da20b9bdd3c7c87809c25ccb2a5993a7ea209a22/semantic_release/history/__init__.py#L41-L49
As
pyproject.toml
is a config file for not only packaging there are other tools that also have a blankversion=
setting likecommitizen
:I think a regex approach for
pyproject.toml
is not good enough and would propose to use atoml
library liketomlkit
to actually load the toml file and extract the correct version. And of cause dump the bumped one afterwards.The semantic-release config could then be like the following with two colons: <file : section : key>
If 2 colons and file is *. toml: load it and extract elif 1 colon: regex and extract else: error
PS: I don’t know how commitizen solves the problem as they have
version_files = ["pyproject.toml:version"]
and it works.