Improve caret translation logic#8
Conversation
metadata_please/source_checkout.py
Outdated
| if not version: | ||
| # e.g. git, path or url dependencies, skip for now | ||
| # e.g. git, path or url dependencies | ||
| if "path" in v: |
There was a problem hiding this comment.
Can you split this change out to a separate PR? This needs more thought and probably some sort of X- prefixed name, as I'm pretty sure they are not valid Requires-Dist.
| version_parts[-1] += 1 | ||
|
|
||
| else: | ||
| raise ValueError("All components were zero?") |
There was a problem hiding this comment.
Can you add a test with ^0 and make sure it does something predictable? I think it's invalid, and I don't know if it will raise (which is fine) or do something less useful like >=0,<1
There was a problem hiding this comment.
That case would return >=0,<1. Similarly, ^0.0 returns >=0.0,<1.0 and ^0.0.0 returns >=0.0.0,<1.0.0. Is it better to raise?
There was a problem hiding this comment.
There are two examples given at the bottom of https://python-poetry.org/docs/dependency-specification/#caret-requirements that are the best spec I can find. My personal read of
An update is allowed if the new version number does not modify the left-most non-zero digit in the major, minor, patch grouping.
is that this isn't a case they've really designed for. I'd think ^0.0.x is compatible with 0.0.xpost1 for example, but the prose implies that isn't the case.
I'm just saying, please add tests for the zero case if it returns now instead of raising.
There was a problem hiding this comment.
Added a check for this case that raises a ValueError!
No description provided.