iceberg-python icon indicating copy to clipboard operation
iceberg-python copied to clipboard

Feat/add client version headers

Open jaimeferj opened this issue 2 months ago • 0 comments

Closes https://github.com/apache/iceberg-python/issues/2373

Rationale for this change

This PR adds client version and git commit tracking headers to match the Java Iceberg client implementation. The Java client sends X-Client-Version and X-Client-Git-Commit-Short headers with all REST catalog requests for better client tracking and debugging.

This implementation:

  • Uses setuptools_scm to capture git version information at build time
  • Extracts the short git commit hash from the version string
  • Sends both headers with all REST catalog HTTP requests

This provides better visibility into which PyIceberg versions and builds are making requests to REST catalogs, helping with debugging and client tracking.

Are these changes tested?

Yes

  • Added test_client_version_headers to verify both headers are set correctly
  • Test validates that X-Client-Version matches the package version
  • Test validates that X-Client-Git-Commit-Short is a valid 7-character hex git hash
  • All existing tests continue to pass

Are there any user-facing changes?

Yes, but minimal:

  • REST catalog HTTP requests now include two additional headers: X-Client-Version and X-Client-Git-Commit-Short
  • This is transparent to users and doesn't affect the API or behavior
  • Server-side operators may see these new headers in their logs for better client tracking

jaimeferj avatar Oct 21 '25 23:10 jaimeferj