Skip to content

fix: replace semver.parse() with semver.Version.parse() in docstrings#471

Merged
tomschr merged 1 commit into
python-semver:masterfrom
koteshyelamati:patch-1
Jul 5, 2026
Merged

fix: replace semver.parse() with semver.Version.parse() in docstrings#471
tomschr merged 1 commit into
python-semver:masterfrom
koteshyelamati:patch-1

Conversation

@koteshyelamati

Copy link
Copy Markdown
Contributor

Problem

Six docstrings in version.py use semver.parse() which returns a plain dict, not a Version object:

>>> ver = semver.parse("3.4.5")
>>> ver.bump_major()  # AttributeError: 'dict' object has no attribute 'bump_major'

Affected methods: bump_major, bump_minor, bump_patch, bump_prerelease, bump_build, next_version.

Fix

Replace all 6 occurrences of semver.parse() with semver.Version.parse(), which correctly returns a Version instance and makes the doctests runnable and accurate.

>>> ver = semver.Version.parse("3.4.5")
>>> ver.bump_major()
Version(major=4, minor=0, patch=0, prerelease=None, build=None)

… docstrings

The docstrings in bump_major, bump_minor, bump_patch, bump_prerelease, bump_build, and next_version used semver.parse() which returns a plain dict, not a Version object. Calling instance methods like .bump_major() on a dict raises AttributeError.

Replace all 6 occurrences with semver.Version.parse() which correctly returns a Version instance, making the doctests runnable and accurate.

@tomschr tomschr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @koteshyelamati for your contribution! 👍

@tomschr tomschr merged commit a8bb4f8 into python-semver:master Jul 5, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants