-
Notifications
You must be signed in to change notification settings - Fork 97
Closed
Labels
EnhancementNot a bug, but increases or improves in value, quality, desirability, or attractivenessNot a bug, but increases or improves in value, quality, desirability, or attractivenessQuestionUnclear or open issue subject for debateUnclear or open issue subject for debate
Description
Situation
At the moment, we don't have a function which checks a version string and returns True/False values.
The user is forced to parse the version string and have to check for a ValueError
exception:
import semver
try:
version = "..."
semver.VersionInfo.parse(version)
# if we are still here, then it's true
except ValueError:
# seems, version wasn't a good semver version
I think, this is a bit cumbersome.
Proposed Solution
It would be nice if we could do something like this:
version = "..."
if semver.VersionInfo.isvalid(version):
print("Good version :-)!")
else:
print("Bad version :-(")
Open questions:
- Is this use case useful?
- Currently, I see
semver.VersionInfo.isvalid()
as a classmethod. Should we better place this function outside the class, likesemver.isvalid()
? - Regardless of the location, is the name ok? It resembles the
is...()
functions from thestr
datatype.
Metadata
Metadata
Assignees
Labels
EnhancementNot a bug, but increases or improves in value, quality, desirability, or attractivenessNot a bug, but increases or improves in value, quality, desirability, or attractivenessQuestionUnclear or open issue subject for debateUnclear or open issue subject for debate