git-changelog icon indicating copy to clipboard operation
git-changelog copied to clipboard

bug: Using PEP440 version doesn't get reflected even when mentioned using `-n pep440`

Open Tuhin-thinks opened this issue 3 months ago • 2 comments

Description of the bug

Generating CHANGELOG using pep440 returns the same string as provided in the --bump flag

while using --bump minor+dev:

image

To Reproduce

git change --config-file pyproject.toml --bump minor+dev

Full traceback

Used pyproject.toml
[tool.git-changelog]
convention = "angular"
in-place = true
output = "CHANGELOG.md"
marker-line = "<!-- insertion marker -->"
parse-refs = false
parse-trailers = false
provider = "github"
repository = "."
sections = "fix,chore,feat,docs,deps,style,refactor,test,perf"
template = "keepachangelog"
version-regex = "^## \\\\[(?P<version>v?[^\\\\]]+)"
versioning = "pep440"
zerover = true

Expected behavior

Generated version should be 0.2.0.dev0

Environment information

git-changelog --debug-info  # | xclip -selection clipboard
- __System__: Linux-6.5.0-26-generic-x86_64-with-glibc2.35
- __Python__: cpython 3.10.12 (/home/tuhin/Downloads/python_env/fastapi_env/bin/python)
- __Environment variables__:
- __Installed packages__:
  - `git-changelog` v2.5.1

Additional context

In the current repo I have a tag v0.1.0.Want to bump it using strategy minor+dev of pep440. But, the version string is coming as minor+dev

Also, at the very top of the CHANGELOG.md it's showing the following line:

and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

This clearly shows the project is not considering the pep440 versioning even after mentioning using -n or --versioning.

While running the following Python snippet shows the exact version that I want:

(fastapi_env) tuhin@tuhinLaptop:~/Documents/projects/fast_api_server$ ipython
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.22.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from git_changelog.versioning import bump_pep440

In [2]: bump_pep440('0.1.0', 'minor+dev')
Out[2]: '0.2.0.dev0'

In [3]: bump_pep440('0.1.0', 'minor+dev')
Out[3]: '0.2.0.dev0'

Tuhin-thinks avatar Apr 04 '24 11:04 Tuhin-thinks

Hello, thanks for the report. I was only able to partially replicate the issue. The bump strategy is wrongly used as is when this is the first tag/version.

Also, at the very top of the CHANGELOG.md it's showing the following line:

Good point, maybe it should link to PEP 440 instead.

pawamoy avatar Apr 04 '24 14:04 pawamoy

I've pushed v2.5.2, let me know if it works for you. I decided not to change the header in the keepachangelog template because you can easily modify it yourself and it won't be touched by git-changelog when you update the changelog in-place.

pawamoy avatar Apr 04 '24 15:04 pawamoy