c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 134 forks source link

Can't find version in setup.py if version under quotation marks instead of apostrophe #197

Closed pauloneves closed 3 years ago

pauloneves commented 3 years ago

Here is a piece of my setup.py file:

setup(
    name="obabr",
    version="1.0.0",

When I try to run bump2version. I get the following error:

$ bump2version major --dry-run --no-commit
Traceback (most recent call last):
  File "C:\Users\ppppp\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\ppppp\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\dev\xxx\Scripts\bump2version.exe\__main__.py", line 7, in <module>
  File "c:\dev\xxx\lib\site-packages\bumpversion\cli.py", line 124, in main
    _check_files_contain_version(files, current_version, context)
  File "c:\dev\xxx\lib\site-packages\bumpversion\cli.py", line 618, in _check_files_contain_version
    f.should_contain_version(current_version, context)
  File "c:\dev\xxx\lib\site-packages\bumpversion\utils.py", line 70, in should_contain_version
    search_expression, self.path
bumpversion.exceptions.VersionNotFoundException: Did not find 'version='1.0.0'' in file: 'setup.py'

Everything works if I change setup.py to

setup(
    name='obabr',
    version="1.0.0",

I use the formatter Black, and it automatically formats my strings with quotation marks.

florisla commented 3 years ago

Can you share your bump2version configuration?

Does it support double quotes in the search pattern?

pauloneves commented 3 years ago

Nice! I didn't know about this file. My setup was created by cookiecutter. I've edited the file to support double quotes and everything is fine now.

Sorry for taking your time.