Support version retrieval from custom branches#253
Conversation
| except AttributeError as attr_err: | ||
| raise ValueError(f'Branch {branch} seems to not have a version in its name.') from attr_err | ||
|
|
||
| return sorted( |
There was a problem hiding this comment.
@Mariatta optionally we could try/except this as well and fall back to returning branches list in their original order.
There was a problem hiding this comment.
@Mariatta what do you think about falling back to unordered branch list?
There was a problem hiding this comment.
Since there is no need to support unordered branch list yet, I'm thinking to keep things as is and not change the behavior.
| def sorted_branches(self): | ||
| def version_from_branch(branch): | ||
| try: | ||
| return tuple(map(int, re.match(r'^.*(?P<version>\d+(\.\d+)+).*$', branch).groupdict()['version'].split('.'))) |
There was a problem hiding this comment.
Maybe reading regex template from config is even better?
There was a problem hiding this comment.
I see how it's more flexible. I was thinking about this, but IRL regex is easy to screw up: they'll be exposed to the internals and helpless, and it would require them to actually scan through the code to figure out how it's being used, why and how to fix that.
It also looks like mixing up higher-level public API with implementation details, which IMHO should be separated.
So I'd be cautious when providing the end-users with such tooling.
What do you think?
There was a problem hiding this comment.
Maybe invite a syntax like stable-* where the star is version?
There was a problem hiding this comment.
It seems to be more complex than needed
|
@Mariatta I'm trying to add this to our workflow and this change would really help to adopt the tool. Would you mind taking a look at it, please? |
|
Sorry for the delay @webknjaz. I intend to review your PRs sometime this week for sure. |
|
Thanks! |
|
Sure, done! |
b2ac064 to
3209061
Compare
|
Thanks! I made some changes to readme, but the rest looks great. Thanks for working on this 🌮 |
|
@Mariatta thanks! Please let me know when it's on PYPI. P.S. If you would like it — I can help with automation of release process of dists from Travis CI to PYPI, triggered by pushing tag, for example. Ping me if you're interested 😉 |
😲 I'm interested. See related issue #222 😄 |
|
@webknjaz released to PyPI 🌮 |
Fixes #251