Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Sep 19, 2025

Description of proposed changes

Query the GDAL version by calling the GDAL C function GDALVersionInfo (https://gdal.org/en/stable/api/raster_c_api.html#_CPPv415GDALVersionInfoPKc).

Fixes #4102.

@seisman seisman added the bug Something isn't working label Sep 19, 2025
@seisman seisman added this to the 0.17.0 milestone Sep 19, 2025
@seisman seisman added enhancement Improving an existing feature and removed bug Something isn't working labels Sep 19, 2025
@seisman seisman added the needs review This PR has higher priority and needs review. label Sep 19, 2025
@seisman seisman requested review from Copilot and weiji14 and removed request for weiji14 September 19, 2025 13:17
Copy link
Contributor

Copilot AI left a comment

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 improves GDAL version reporting in PyGMT by querying the GDAL version directly from the GDAL C library using ctypes instead of relying on Python package metadata.

  • Adds a new _get_gdal_version() function that uses ctypes to call the GDAL C API's GDALVersionInfo function
  • Updates the dependency information collection to use the new GDAL version function instead of treating GDAL as a regular Python package
  • Adds test assertions to verify that GDAL version is properly reported and not returning None

Reviewed Changes

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

File Description
pygmt/_show_versions.py Implements new GDAL version detection using ctypes and updates dependency collection logic
pygmt/tests/test_show_versions.py Adds test coverage to verify GDAL version is correctly reported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@seisman seisman merged commit 9767246 into main Sep 20, 2025
22 of 24 checks passed
@seisman seisman deleted the gdal/version branch September 20, 2025 04:41
@seisman seisman removed the needs review This PR has higher priority and needs review. label Sep 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pygmt.show_versions doesn't show GDAL version

3 participants