iceberg-python
iceberg-python copied to clipboard
Feat/add client version headers
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_scmto 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_headersto verify both headers are set correctly - Test validates that
X-Client-Versionmatches the package version - Test validates that
X-Client-Git-Commit-Shortis 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-VersionandX-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