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
Normalization of equivalent versions #121
Comments
This is a little complicated by the fact that there can be any number of components in the
I'm not sure I like it. |
Did you mean to close this? FWIW we have a import re
from ..version import parse as parse_version
def canonicalize_version(version):
# Get the string into it's "Normal" form, but this can still include additional 0s
version = str(parse_version(version))
return re.sub(r"^((?:0\.)+)", "", version[::-1])[::-1] I'd have to go over PEP 440 to be sure, but that should turn any PEP 440 compatible version into a unique string. It obviously wouldn't retain the number of zero's that the package originally had, but if it's not being displayed to users that shouldn't really matter. |
Ah. I got stuck in the rut of thinking only about adding I'll work on adding this. |
@di I realize my code doesn't really work, since you have to do like The basic idea should still work though, it just might need to either live on the version object so it can get access to the internals to reconstruct it, or you might need to solve #34 so that the |
It'd be nice if there was an easy way to get a "normalized" version, e.g.:
The text was updated successfully, but these errors were encountered: