Skip to content

Conversation

@jaimeferj
Copy link
Contributor

Closes #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 jaimeferj force-pushed the feat/add-client-version-headers branch from af393dc to 0d2e197 Compare October 22, 2025 09:21
session.headers.update(header_properties)
session.headers["Content-type"] = "application/json"
session.headers["User-Agent"] = f"PyIceberg/{__version__}"
session.headers["X-Client-Version"] = __version__
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @jaimeferj for working on this. Wouldn't this make the User-Agent header the line above redundant?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make X-Client-Version header more similar to Iceberg Java

2 participants