Skip to content

Follow Semantic Versioning and remove the leading v from version string - #4838

Open
seisman wants to merge 14 commits into
mainfrom
semver
Open

Follow Semantic Versioning and remove the leading v from version string#4838
seisman wants to merge 14 commits into
mainfrom
semver

Conversation

@seisman

@seisman seisman commented Aug 14, 2026

Copy link
Copy Markdown
Member

Previously, pygmt.__version__ was in the format of vX.Y.Z. This PR removes the leading v, thus, the version is in the format of X.Y.Z.

It should has minor effects on users, as packaging.version.Version can handle leading v properly:

>>> from packaging.version import Version
>>> Version("0.19.0") == Version("v0.19.0")
True

Addresses #4790

I used ack 'v[0-9]*\.[0-9]*\.[0-9]*' to ensure are related cases are fixed, except:

  • doc/_static/version_switch.js: 'v0.19.0': 'v0.19.0'. The first one controls the URL, while the 2nd one controls the text string shown in the version switcher. We can't update the first one, because it will break many existing references to the PyGMT documentation. I think it's better to keep these two consistent. So, none of them are changed.
  • doc/minversions.md: The first column shows v0.19.0. It's technically difficult to change it to 0.19.0, because it's linked to the v0.19.0 tag.

Preview: https://pygmt-dev--4838.org.readthedocs.build/en/4838/index.html

@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. labels Aug 14, 2026
@seisman seisman added this to the 0.20.0 milestone Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates PyGMT to follow Semantic Versioning more strictly by removing the leading v from pygmt.__version__, and aligns various deprecation markers, warnings, comments, and maintenance documentation with the X.Y.Z version format.

Changes:

  • Change pygmt.__version__ to return X.Y.Z (no leading v) via importlib.metadata.version.
  • Update deprecation directives/decorator arguments and warning/error message text to use X.Y.Z.
  • Adjust maintainer/release documentation and checklist to reflect the new version-string convention.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pygmt/_show_versions.py Removes v prefix from __version__ and updates Ghostscript/GMT warning strings.
pygmt/helpers/decorators.py Updates version strings in comments/errors and in deprecate_parameter doc examples.
pygmt/src/basemap.py Updates deprecation notes and warning message to use 0.19.0 format.
pygmt/src/coast.py Updates deprecation directive version formatting and reflows text.
pygmt/src/subplot.py Updates deprecated directive and deprecate_parameter decorator version args.
pygmt/src/grdsample.py Updates deprecate_parameter decorator version args.
pygmt/clib/session.py Updates version references in comments to drop leading v.
pygmt/figure.py Updates a comment that references a dependency version string.
pygmt/datasets/tile_map.py Minor comment tweak; still uses pygmt.__version__ for User-Agent construction.
pygmt/tests/test_timestamp.py Updates docstring text referencing the removal version.
doc/maintenance.md Updates semantic-versioning wording and deprecation example versions.
.github/ISSUE_TEMPLATE/4-release_checklist.md Updates release checklist guidance for version strings (including Zenodo version field).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 180 to 182
# TODO(contextily>=1.7.0): Remove once contextily>=1.7.0 is required.
# The 'headers' parameter was added in contextily v1.7.0
# The 'headers' parameter was added in contextily 1.7.0.
if Version(contextily.__version__) < Version("1.7.0"):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 02dd66b.

Comment thread pygmt/_show_versions.py
Comment on lines 19 to 23
# Get semantic version through setuptools-scm
__version__ = f"v{version('pygmt')}" # e.g. v0.1.2.dev3+g0ab3cd78
__version__ = version("pygmt") # e.g., 0.1.2.dev3+g0ab3cd78
__commit__ = ( # 0ab3cd78
__version__.rsplit(sep="+g", maxsplit=1)[-1] if "+g" in __version__ else ""
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 8cf07e4.

@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Aug 21, 2026
@seisman
seisman requested a review from a team August 21, 2026 08:24

@yvonnefroehlich yvonnefroehlich 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.

Wondering if we should update the table for the Minimum Supported Version (https://pygmt-dev--4838.org.readthedocs.build/en/4838/minversions.html), even we are linking to the GitHub tags, where we still use the "v".

Edit: See first comment of PR why this was not changed.

Comment thread pygmt/helpers/decorators.py Outdated
Comment thread pygmt/helpers/decorators.py Outdated
Comment thread pygmt/helpers/decorators.py Outdated

@yvonnefroehlich yvonnefroehlich 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.

Do the changes in this PR affect the URL to the PyGMT website? Currently we use the "v" there, e.g., https://www.pygmt.org/v0.19.0/index.html. If we remove the "v", the old version specific URLs will not resolve anymore.

Edit: Not changed, see first comment of this PR.

seisman and others added 2 commits August 22, 2026 01:25
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
@seisman

seisman commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

Wondering if we should update the table for the Minimum Supported Version (https://pygmt-dev--4838.org.readthedocs.build/en/4838/minversions.html), even we are linking to the GitHub tags, where we still use the "v".

Edit: See first comment of PR why this was not changed.

It's not that difficult as I initially thought. See changes in 52d49f7.

Edit: Actually, changes in 52d49f7 works well for <tag:0.19.0>/<doc:0.19.0> but not for <doc:dev>/doc:dev/pygmt-docs.zip, so I have to revert that commit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

final review call This PR requires final review and approval from a second reviewer maintenance Boring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants