bumpversion
bumpversion copied to clipboard
Issue while using search and replace configurations.
Thanks for replying. I'd tried to add search
and replace
options but these don't work as expected.
Here is my .bumpversion.cfg
file:
[bumpversion]
current_version = 0.2.2
[bumpversion:file:setup.py]
search = version='{current_version}',
replace = version='{new_version}',
And here is the setup.py
when I run the bumpversion command:
from setuptools import setup, find_packages
setup(
name='my-pack',
version='0.2.3',
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=[
'someotherpackage==version='0.2.3',',
],
)
It would be great if you can help me in this problem.
Originally posted by @mss30 in https://github.com/peritus/bumpversion/issues/201#issuecomment-484487322
It is best to remove quotes in .bumpversion.cfg and it run
[bumpversion:file:setup.py]
search = version={current_version},
replace = version={new_version},
I had the same issue using the same bumpversion config file and after using pdb to understand why this is happening, I realized that the _replace_version_in_files() function was called two times on the same setup.py file.
It was because I used the command : bumpversion minor setup.py
but no need to specify setup.py as positional argument because it's already specified in bumpversion config file.
I don't really understand why on the second run it updated the dependency version but by running only that command bumpversion minor
it does the trick.