You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Semver versioning is incompatible with pypi dist cleansing #335
The Semver package doesn't correctly characterise versions, raising errors for valid semver tags.
To Reproduce
VersionInfo.parse("3.0.0.dev0")
File "~/myrepo/venv/lib/python3.7/site-packages/semver.py", line 726, in parse
raise ValueError("%s is not valid SemVer string" % version)
ValueError: 3.0.0.dev0 is not valid SemVer string
Expected Behavior
3.0.0.dev0 is a valid semver tag, no error should be thrown
Hi @KitBurgess thanks for your report, much appreciated. 👍
Well, I fear, your example is not a valid semver version. According to the semver specification, version core (the major, minor, patch part) is separated by a "-" (dash) from the prerelease dev0). Your example contains a dot which is an invalid character. So the exception is correct.
If you change your example to "3.0.0-dev0" this would be a valid semver version and accepted.
Maybe I completely misunderstood your intention, but here is a second thought.
Do you mean the version from PyPI?
This is indeed an invalid semver version. However, I can't influence that as it is created automatically by setup.py sdist (run by tox -e prepare-dist).
If you want to convert such versions, you could do that with the packaging.version module like this:
I've created a PR #352 based on our conversation, sorry for the delay. Would this help? If you like and have time, could you review the PR? That would be very helpful for me. Thanks! ❤️
Activity
tomschr commentedon Dec 31, 2020
Hi @KitBurgess thanks for your report, much appreciated. 👍
Well, I fear, your example is not a valid semver version. According to the semver specification, version core (the major, minor, patch part) is separated by a "-" (dash) from the prerelease
dev0). Your example contains a dot which is an invalid character. So the exception is correct.If you change your example to "3.0.0-dev0" this would be a valid semver version and accepted.
Hope this helps.
tomschr commentedon Jan 1, 2021
Happy new year! 🎉 😁
Maybe I completely misunderstood your intention, but here is a second thought.
Do you mean the version from PyPI?
This is indeed an invalid semver version. However, I can't influence that as it is created automatically by
setup.py sdist(run bytox -e prepare-dist).If you want to convert such versions, you could do that with the
packaging.versionmodule like this:I think, it could be a helpful addition to our documentation. Would that help?
tomschr commentedon Jan 27, 2022
Hi @KitBurgess,
I've created a PR #352 based on our conversation, sorry for the delay. Would this help? If you like and have time, could you review the PR? That would be very helpful for me. Thanks! ❤️
tomschr commentedon Feb 11, 2022
As the PR is already merged and I didn't get any response, I assume it was okay. If there are still some questions, reopen it.
Thanks!