Closed aced125 closed 3 years ago
It looks like your bump2version configuration does not match properly with the version string.
This causes an incorrect search/replace, like described in #127.
Can you share your bumpversion.cfg
or setup.cfg
file?
# setup.cfg
[bumpversion]
current_version = 0.1.0
commit = True
tag = True
[bumpversion:file:setup.py]
search = version='{current_version}'
replace = version='{new_version}'
[bumpversion:file:protoattend/__init__.py]
search = __version__ = '{current_version}'
replace = __version__ = '{new_version}'
[bdist_wheel]
universal = 1
[flake8]
exclude = docs
[aliases]
test = pytest
[tool:pytest]
collect_ignore = ['setup.py']
Am I reading it correct that black formats it using "
but you have setup.cfg configured to use '
? If so, then setup.cfg
should be changed to use "
.
I am having this same issue. Not that its unsolveable, but it does make the use of autoformatters a bit more involved.
Hi all, Using the proposed solution and the setup.cfg below, this issue goes away for major and minor releases, but it still happens for micro releases. Any ideas?
[bumpversion]
current_version = 0.1.0
commit = False
tag = True
[bumpversion:file:setup.py]
search = version="{current_version}"
replace = version="{new_version}"
[bumpversion:file:enterpylink/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"
init.py has: __version__ = "0.1.0"
setup.py has: version="0.1.0",
after running "bump2version minor" (major performs similarly), the results are as expected:
init.py has: __version__ = "0.2.0"
setup.py has: version="0.2.0",
However, if I run "bump2version micro", the below is what I see:
init.py has: __version__ = "__version__ = "0.1.0""
setup.py has: version="version="0.1.0"",
@aaronsmith1234 I didn't know micro
was even a valid value for part
.
Does the same happen if you use bump2version patch
?
@s-weigand yes, patch works fine. Don't know where I got micro from, will use patch going forward!
Seems like this is all working as it should. #127 will prevent syntax errors like the original poster encountered.
Hi,
Bump2version does not work when the new black formatter is on.
It formats all single quotes
'
as double quotes"
, which in turn causes the formatter to do this:which in turn causes the egg files to become: (Travis logs below)
which causes the Travis build to fail:
HTTPError: 400 Client Error: 'version-0.1.7-' is an invalid value for Version. Error: Start and end with a letter or numeral containing only ASCII numeric and '.', '_' and '-'. See https://packaging.python.org/specifications/core-metadata for url: https://upload.pypi.org/legacy/
.The solution for now is to wrap setup.py code in
however we would prefer a fix from bump2version