Skip to content

Add linehaul telemetry data to User-Agent header for PyPI statistics#2184

Merged
cjames23 merged 4 commits intopypa:masterfrom
guillermodotn:dev
Apr 30, 2026
Merged

Add linehaul telemetry data to User-Agent header for PyPI statistics#2184
cjames23 merged 4 commits intopypa:masterfrom
guillermodotn:dev

Conversation

@guillermodotn
Copy link
Copy Markdown
Contributor

Summary

Adds linehaul-compatible platform metadata to the User-Agent header sent during hatch publish.

Closes #2111

Design decisions

  • Separate CI detection for linehaul vs CLI: linehaul._looks_like_ci() uses existence-based env var checks (matching pip), while the existing ci.running_in_ci() keeps its stricter value-based check for CLI interactive mode.
  • distro is lazy-imported inside the Linux-only code path and declared as a platform-conditional dependency.
  • Result is cached with @lru_cache since platform data is constant for the process lifetime.
  • setuptools_version/rustc_version fields are omitted.

Comment thread src/hatch/utils/linehaul.py
Copy link
Copy Markdown
Member

@cjames23 cjames23 left a comment

Choose a reason for hiding this comment

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

Thanks for contributing this!

@cjames23 cjames23 merged commit 080a53f into pypa:master Apr 30, 2026
49 checks passed
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.

Support linehaul data in user agent

2 participants