Skip to content

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

Open
seisman wants to merge 8 commits into
mainfrom
semver
Open

Follow Semantic Versioning and remove the leading v from version string#4838
seisman wants to merge 8 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.

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

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

Labels

maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants