hatch doesn't use bump-my-version

Describe the bug

Hi tbc Team!

I'm trying to use the python template in combination with the semantic-release template and hatch as the python project management tool. When a new hatch project is created the project configurator creates a file src/myproject/__about__.py with the version number an then refrerences this version by doing

[project]
name = "myproject"
dynamic = ["version"]

and

...
[tool.hatch.version]
path = "src/myproject/__about__.py"

...

in the pyproject.toml. To be able to increase the version bump-my-version can be configured in the pyproject.toml file to use the __about__.py too:

...
[[tool.bumpversion.files]]
filename = "src/myproject/__about__.py"
search = "__version__ = \"{current_version}\""
replace = "__version__ = \"{new_version}\""

[[tool.bumpversion.files]]
filename = "pyproject.toml"
search = "version = \"{current_version}\""
replace = "version = \"{new_version}\""

[tool.bumpversion]
current_version = "1.29.7"                                    # this is set by bumpversion after the initial setup
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"
replace = "{new_version}"
tag = false                                                   # Don't create git tags (semantic-release handles this)
commit = false                                                # Don't create git commits (semantic-release handles this)

In theory and on my local machine this configuration works as expected (test with bump-my-version bump patch --vv) but when using it with the tbc template it isn't working because the template uses toml-cli (https://gitlab.com/to-be-continuous/python/-/blob/master/templates/gitlab-ci-python.yml?ref_type=heads#L977) to edit the pyproject.toml directly, even though the documentation states, that bump-my-version is used

hatch: uses bump-my-version as version management, build as package builder and publish to publish.

Expected behavior

The default src/myproject/__about__.py can be used. If this configuration is in use, either the manual config of bump-my-version can be done or (even better) the template is smart enough to detect this variant. Also the __about__.py file needs to be added in the git add Command too. At least it should use the bump-my-version command like in the "uv without uv version support".

Actual behavior

Using a dynamic version is not possible with the tbc templates.

Logs and/or screenshots

No logs from the private project but the error is that toml-cli is adding a second version entry because it does'nt know anything about the dynamic version.

Context & Configuration

See the configuration examples in the description above.

The issue was reproduced using:

  • Version of the template: 7.11.2
  • GitLab server(s): self hosted Gitlab server, Ultimate Edition, version
  • GitLab runner(s): (type in any relevant information about the GitLab runner(s) you used)

Here is the .gitlab-ci.yml file:

  - component: $CI_SERVER_FQDN/to-be-continuous/python/gitlab-ci-python@7.11.2
    inputs:
      image: custom-python-baseimage:0.5
      ruff-enabled: false
      pytest-enabled: false
      bandit-enabled: false
      release-enabled: true
      auto-release-enabled: true
      bandit-args: -c pyproject.toml --recursive 

the image is a regular python image, with preinstalled hatch.

Configured GitLab CI project or group variables:

None that should affect this issue.