-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Detecting whether a Python was built by python-build-standalone
#382
Comments
For example, this is a candidate though could obviously cause problems (false negatives or false positives): >>> sysconfig.get_config_vars()['prefix']
'/install' But if there's some kind of dedicated flag or metadata, it would of course be preferable. |
There shouldn't be false negatives from the |
(I just meant false negatives in the event that the value differed at some previous point in the |
For what it's worth, I think there are good reasons not to have this exposed. It does enable clients to special-case |
The standalone distributions do need to be special cased though, i.e., |
Analogy to a web browser... Issue is asking to use User-Agent detection. Seasoned web developers will tell you to sniff for features/bugs and not use the UA string as a proxy. For the same reason you shouldn't use UA strings, we shouldn't key off an "is PBS" flag. But it could be nice to know a Python is PBS. If someone wants to footgun themselves keying functionality off that flag, so be it. Perhaps we could add the PBS advertisement in the Python --version output? I think there's a configure flag to add supplemental text here. It's analogous to a UA string and feels like the right place to put it. |
@indygreg -- Can you think of anything we might use for the existing releases? :) |
For existing releases, the /install or /build references are probably the best we have. And those are prone to false positives. It makes sense to expose something more explicit going forward. Something in the version metadata (I think there's a vendor string or something) and maybe a new sysconfig define if a vendor string can't be easily read/parsed at runtime. |
(In uv, we now mark this in sysconfig after we unzip.) |
Due to #380, I'm looking for a way to detect whether a given Python interpreter was built by
python-build-standalone
. Is there any reliable metadata (maybe something onsysconfig.get_config_vars()
) to support this?The text was updated successfully, but these errors were encountered: