-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include rustc version in the user agent, if rustc is available #9987
Conversation
Rust is becoming more popular for writing Python extension modules in, this information would be valuable for package maintainers to assess the ecosystem, in the same way glibc or openssl version is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm neutral on whether we should include this, but in general it looks fine. Should we not add a test to verify that the information is being included correctly? I don't know if we have other user-agent checks, TBH.
@@ -598,13 +598,14 @@ def make_var(name): | |||
with open(tmpdir.joinpath('req1.txt'), 'w') as fp: | |||
fp.write(template.format(*map(make_var, env_vars))) | |||
|
|||
session = PipSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file around PipSession
seem unrelated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're not -- PipSession now checks for an env var (specifically PATHEXT
on Windows), and these were being constructed inside a monkey-patch of getenv (which was intended to test parse_requirements
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Can you add a comment explaining this, as it seems like a very subtle interaction that would be incredibly hard to diagnose if someone later decided to omit the extra variable as part of a tidy-up.
Actually, does that mean we're doing the subprocess call every time we construct a PipSession
? Would it not be better to just calculate the rust version once, as it's not as if it's going to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
And yes, we do it once per PipSession. While we construct a few of them in tests, I think in pip
itself, it's only ever constructed once, so I'm not sure it's a big deal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably not. Test suite times are dominated by running pip over and over, so a couple of extra rustc runs isn't going to harm anything.
I feel we should. Some people care very much about what local information is sent (for telemetry stuff) so we should be as transparent about this as possible. |
How do you intend to retrieve the message, via PyPI’s BigQuery? I’m wondering whether we should mention this in the fragment. Implementation-wise LGTM. |
Yeah, bigquery. I looked at the full changelog, and bigquery isn't mentioned for the other UA changes. |
For anyone interested, this is now live in PyPI's public dataset for both downloads and simple requests: SELECT
details.rustc_version,
COUNT(*) AS total_downloads
FROM
`bigquery-public-data.pypi.file_downloads`
WHERE
DATE(timestamp) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
AND CURRENT_DATE()
GROUP BY
details.rustc_version
ORDER BY
total_downloads DESC
|
Rust is becoming more popular for writing Python extension modules in, this information would be valuable for package maintainers to assess the ecosystem, in the same way glibc or openssl version is.
Does this requires a newsfragment for pip? I'm not sure whether this is considered a user-facing change or not.