Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Normalization of equivalent versions #121
referenced this issue
Feb 12, 2018
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.
@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