Uh oh!
There was an error while loading. Please reload this page.
Fix constraints duplication - #69
Conversation
pombredanne
left a comment
There was a problem hiding this comment.
Thank you . Here are a few comments for your consideration.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
4bac91c to
328ba06Comparepombredanne
commented
May 18, 2022
@keshav-space BTW, you do not need to wait to fix the semantic-version issue... Now the plot thickens, as per https://semver.org/#spec-item-10 :
A change will therefore likely be controversial upstream in @rbarrois code. IMHO the rationale is that we always want a stable sort order of versions and ignoring the build segment when sorting versions does not make sense as this lead to random ordering. Reporting two otherwise identical versions with different build as being the "same" or "equivalent" or "having the same precedence" but not "equal" is IMHO useful but this should not go in the way of a sensible stable sorting/ordering of versions sequence. @keshav-space for now you can subclass all right to create a correct sorting The issue: >>>fromsemantic_versionimport*>>>v1=Version('1.2.3+123')
>>>v1Version('1.2.3+123')
>>>v1.precedence_key
(1, 2, 3, (MaxIdentifier(),))
>>>v2=Version('1.2.3+234')
>>>v2.precedence_key
(1, 2, 3, (MaxIdentifier(),))
>>>sorted([v2, v1])
[Version('1.2.3+234'), Version('1.2.3+123')]
>>>sorted([v1, v2])
[Version('1.2.3+123'), Version('1.2.3+234')]duh! >>>classSortableSemverVersion(Version):
... @property
... defprecedence_key(self):
... returnsuper().precedence_key+ (self.build,)
... >>>sv1=SortableSemverVersion('1.2.3+123')
>>>sv2=SortableSemverVersion('1.2.3+234')
>>>sorted([sv1, sv2])
[SortableSemverVersion('1.2.3+123'), SortableSemverVersion('1.2.3+234')]
>>>sorted([sv2, sv1])
[SortableSemverVersion('1.2.3+123'), SortableSemverVersion('1.2.3+234')]much better! now IMHO the fact that semver specs does not define precendence does not mean that this library should not have a stable ordering |
pombredanne
commented
May 18, 2022
Also see https://github.com/npm/node-semver/blob/c56a701f45653940ee8536eafe43b3e46c11d6cc/functions/compare-build.js#L5 and https://github.com/npm/node-semver/blob/c56a701f45653940ee8536eafe43b3e46c11d6cc/classes/semver.js#L152 |
keshav-space
commented
May 18, 2022
Yeah, It makes a lot more sense to have an in-house fix for this. I don't see this making its way upstream. |
pombredanne
commented
May 18, 2022
I think it should as a random, non-stable sort is a terribly bad thing IMHO |
rbarrois
commented
May 18, 2022
Hey, just chiming in since I got mentioned: I agree that a "random" sort would be an issue; and that's a use-case that should be addressed one way or another in python-semanticversion. In order to move forward, could you please open an issue in my project, explaining which behaviour you would expect as a "stable" ordering? Thanks! |
keshav-space
commented
May 18, 2022
@rbarrois awesome! will raise an issue for this along with the potential patch. We can take it forward from there :) |
rbarrois
commented
May 18, 2022
No problem ;) I recommend starting with an issue where we can discuss the expected API / behaviour; the implementation is easy to build once that consensus has been reached ;) |
keshav-space
commented
May 18, 2022
|
pombredanne
left a comment
There was a problem hiding this comment.
Thanks! see some feedback inline. You have test failures too.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
- add test for constraint duplicaton - closes: aboutcode-org#45 Signed-off-by: Keshav Priyadarshi <git@keshav.space>
- Revert this once this is fixed in upstream - rbarrois/python-semanticversion#132 Signed-off-by: Keshav Priyadarshi <git@keshav.space>
0fc20b6 to
df34260Comparekeshav-space
commented
May 30, 2022
Tracking for the inconsistent affected version range in Context: https://github.com/nexB/vulnerablecode/wiki/WeeklyMeetings#strange-gitlab-version-ranges |
keshav-space
commented
Jun 15, 2022
Something weird is happening here >>>fromunivers.utilsimportSortableSemverVersion>>>ssv1=SortableSemverVersion.coerce("1.3")
>>>ssv2=SortableSemverVersion("1.3.0")
>>>ssv1==ssv2True>>>ssv1>ssv2False>>>ssv1<ssv2True>>>ssv1Version('1.3.0')
>>>ssv2SortableSemverVersion('1.3.0')The root of this problem |
pombredanne
left a comment
There was a problem hiding this comment.
Is this duplicated (in part?) with #75 ?
keshav-space
commented
Aug 2, 2022
pombredanne
commented
Oct 20, 2022
@keshav-space gentle ping... let's find a way to get this merged! |
keshav-space
commented
Oct 21, 2022
#69 (comment), #69 (comment) |
Closes: Handle possible duplication of constraints in VersionRange #45