Skip to content

VersionInfo.next_version() returns Union[VersionInfo, str] #251

@tlaferriere

Description

@tlaferriere

VersionInfo.next_version() return type is uncertain because at line 463 of semver.py return version.replace(prerelease=None, build=None) returns a VersionInfo object, whereas in line 466 it is explicitly converted to str and at line 470, version.bump_prerelease() is documented with rtype: str.
This is problematic because if you call this on a version that has a prerelease or build number, you get a VersionInfo object, and otherwise you get a str, and these two types must be handled quite differently.

Personally, I would expect VersionInfo.next_version() to return a VersionInfo object in all cases, but I think the main problem here is the ambiguity of the return type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError, flaw or fault to produce incorrect or unexpected resultsDocDocumentation related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions