question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quotation marks matter

See original GitHub issue

I had version="0.2.0" in my setup.py but when updating using bump2version patch it made version="version='0.2.0'" Changing it to version='0.2.0' did solve the problem for now

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

5reactions
florislacommented, Jul 16, 2019

You are right that quotation marks matter.

But that’s fine – you may want it to match either single or double quotes, but not the other.

The problem is that supporting both quotation styles at the same time is hard to do – search does not accept regular expressions.

I remember I’ve worked around this in the past, but I can’t seem to reproduce this at the moment. I probably included the quotation marks in the parse string in some way.

[bumpversion:file:setup.py]
parse = version\s*=\s*['"](?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)['"]

For the record, here’s what’s causing the weird result:

Your setup.py contained double quotes version="0.2.0" but your search was looking for single quotes version='{current_version}'. Consequently, the search pattern did not match. (Unfortunately, this failure happens silently, even in verbose mode)

In that case, Bump2version (silently) falls back to the default search, using the serialize pattern (in this case the default {major}.{minor}.{patch}). This resulted in a match on 0.2.0 in the string version="0.2.0".

It replaces the match with the new version, which you defined in replace = version='{new_version}'.

So version="0.2.0" becomes version="version='0.2.1'".

4reactions
schuderercommented, Jul 20, 2019

Thanks for the explanation! I’m leaving this comment as a heads-up for users using the excellent black formatter, which changes single quotes into double quotes. So if you’re a user of black, you probably need to change the search/replace patterns in your bumpversion.cfg (or setup.cfg) to use " instead of '.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Correct Usage of Quotation Marks in Academic Writing - Enago
Quotation marks are used to show that the text is taken word for word from another source, to call attention to an important...
Read more >
Quotation Marks "" | Writing - EnglishClub
We use quotation marks to show (or mark) the beginning and end of a word or phrase that is somehow special or comes...
Read more >
Single vs. Double Quotes: How & When to Use Quotation Marks
The preference for the single and double quotation marks is largely a matter of style. American writers will use double quotation marks to ......
Read more >
Quotation Marks and Direct Quotations - University of Sussex
The use of quotation marks, also called inverted commas, is very slightly complicated by the fact that there are two types: single quotes...
Read more >
When and how to use quotations in academic writing | Paperpal
One of the easiest punctuation marks that you can get wrong is quotation marks, also called inverted commas, quotes, or speech marks. Why?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found