-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate-bids should use lowest supported BIDS version for earlier ones #950
Comments
Solved in 5fc7b06 other than presenting a warning. Not sure what sort of warning would be appropriate... As for version comparison, Python auto-referencing of the ASCII table (or is it unicode?) has us covered: >>> "1.7.0"<"1.7.0+012"
True
>>> "1.7.0+011"<"1.7.0+012"
True
>>> "1.7.0+013"<"1.7.0+012"
False
>>> "1.7.0+012"<"1.7.0+012+dandi001"
True
>>> "1.7.0+012+dandi002"<"1.7.0+012+dandi001"
False
>>> "1.7.0+013"<"1.7.0+012+dandi001"
False AFAICT the only surprises that this could cause are due to the fact that both ASCII and unicode list uppercase before lowercase, so: >>> "1.7.0+012+DANDI002"<"1.7.0+012+dandi001"
True |
I would prefer to avoid relying on plain string comparison of semantic versions composed from numbers, could just bite somehow unexpectedly e.g
it is just a matter of semver to have "Identifiers MUST NOT be empty. Build metadata MUST be ignored when determining version precedence. " although difference between <= and == and < confuses me -- may be a bug in semver?$> python3 -c 'from semantic_version import Version; print(Version("1.7.0")==Version("1.7.0+012"))'
False
$> python3 -c 'from semantic_version import Version; print(Version("1.7.0")<Version("1.7.0+012"))'
False
$> python3 -c 'from semantic_version import Version; print(Version("1.7.0")<=Version("1.7.0+012"))'
True hence we should ignore it is as well. I gave a sketch for possible tune up in https://github.com/dandi/dandi-cli/pull/955/files#r852231652 |
I thought the 3-digit length is fixed... Ok then :( I really liked the idea of leveraging plain string comparison, though, since it's refreshingly simple :) |
Revisiting this, since >>> from semantic_version import Version
>>> Version("1.7.0+012")<=Version("1.7.0+012+dandi001")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/site-packages/semantic_version/base.py", line 105, in __init__
major, minor, patch, prerelease, build = self.parse(version_string, partial)
File "/usr/lib/python3.9/site-packages/semantic_version/base.py", line 311, in parse
raise ValueError('Invalid version string: %r' % version_string)
ValueError: Invalid version string: '1.7.0+012+dandi001' Given that this is the dandi-cli bundled version of the validator and we haven't even started trying to push At this point I'd say it would be best in both cases to either (1) accept the risk of plain string comparison, or (2) write a small function to implement the comparison we need. I thing the former is cooler :) Leaving this open for now, pending your feedback on the solution. Warning and working string comparison is in as of 1a6d835 and previous. |
ok, you convinced me -- just do string comparison for now. |
I believe #955 addressed this, and should have closed it . |
per our face-to-face discussion, if BIDSVersion has no present schemadata -- use
1.7.0+012
we carry after issuing a warning about that. As for version comparison -- seems to NOT work withsemantic_version
we already useso let's not sweat about that for now with all the
+
s we have ATM.The text was updated successfully, but these errors were encountered: