4

I have a pyproject.toml with

[tool.poetry]
name = "my-project"
version = "0.1.0"

[tool.commitizen]
name = "cz_conventional_commits"
version = "0.1.0"

I add a new feature and commit with commit message

feat: add parameter for new feature

That's one commit.

Then I call

commitizen bump

Commitizen will recognize a minor version increase, update my pyproject.toml, and commit again with the updated pyproject.toml and a tag 0.2.0.

That's a second commit.

But now my pyproject.toml is "out of whack" (assuming I want my build version in sync with my git tags).

[tool.poetry]
name = "my-project"
version = "0.1.0"

[tool.commitizen]
name = "cz_conventional_commits"
version = "0.2.0"

I'm two commits in, one tagged, and things still aren't quite right. Is there workflow to keep everything aligned?

Shay
  • 1,368
  • 11
  • 17

1 Answers1

4

refer to support-for-pep621 and version_files

you can add "pyproject.toml:^version" to pyproject.toml:

[tool.commitizen]
version_files = [
    "pyproject.toml:^version"
]
Gary Yu
  • 56
  • 4
  • Just to add, ensure that the project version and commitizen version are in sync before bumping (you can do this manually) and this should be a one-time thing. If not in sync prior to bump, bump(s) won't update project version – ivenpoker Mar 11 '23 at 12:22