Consider some random python module that is in a git-versioned folder, tagged as 1.0.0-rc1 (release candidate. See semantic versioning: https://semver.org/spec/v2.0.0-rc.1.html)
The following code does not retrieve the right version string: the dash before the pre-release info is removed
from getversion import get_module_version
# import whatever local folder or file is available in this git folder
import my_module
# get the version and details. it will fallback to using the setuptools_scm one
ver, details = get_module_version(my_module)
print(details) # SUCCESS on the setuptools_scm one (the last one)
print(ver) # prints "1.0.0rc1" instead of "1.0.0-rc1"
This has for example as consequence that the resulting version string is not compliant with semver while the initial git tag was:
from semver import parse_version_info
parse_version_info("1.0.0-rc1") # this is ok
parse_version_info("1.0.0rc1") # this fails
raises ValueError: 1.0.0rc1 is not valid SemVer string
Consider some random python module that is in a git-versioned folder, tagged as
1.0.0-rc1(release candidate. See semantic versioning: https://semver.org/spec/v2.0.0-rc.1.html)The following code does not retrieve the right version string: the dash before the pre-release info is removed
This has for example as consequence that the resulting version string is not compliant with
semverwhile the initial git tag was:raises
ValueError: 1.0.0rc1 is not valid SemVer string