stdlib-list icon indicating copy to clipboard operation
stdlib-list copied to clipboard

Generated module _sysconfigdata_...

Open jayvdb opened this issue 6 years ago • 4 comments

Stdlib module sysconfig generates a cache called _sysconfigdata_... with an arch & build flags specific suffix.

This should be recognised as a stdlib package, but the flat file lists currently used dont lend themselves to this dynamic module name very well. Listing all possible suffixes seems like a bad approach.

jayvdb avatar Dec 22 '19 08:12 jayvdb

Sorry for the delayed response here: could you say some more about how this module is imported? import _sysconfigdata_ doesn't work on my host (Linux, Python 3.11.2).

(Pragmatically speaking, it's hard to get a "perfect" stdlib list, because there is no such thing: any list we collect will likely contain things that some users of the same Python version won't be able to import, and will likely miss other things that others would be able to import. The best we can do is automate the 99.9% case; if there's a way to do that for _sysconfigdata_, then we absolutely should!)

woodruffw avatar Jun 29 '23 02:06 woodruffw

See https://github.com/python/cpython/blob/main/Lib/sysconfig.py#L461 for how you get the name of the module for your host.

jayvdb avatar Jun 29 '23 02:06 jayvdb

Thanks. It looks like the importable name here is going to be fundamentally host-specific, so any amount of AOT generation is likely to miss some host configurations.

We could instead do it on-the-fly for the host that we're installed on, but that changes the architecture of this package a bit (and moves it away from a pure data package). Given that, for the time being, I'm inclined to say that this is out-of-scope for this package.

There also appears to be some history of Python and upstream OS distributions messing with this module path, introducing further uncertainty: https://github.com/pypa/setuptools/issues/2946

woodruffw avatar Jun 29 '23 02:06 woodruffw

Perhaps in_stdlib can detect the prefix and return True, even if it isnt included in the list?

jayvdb avatar Jun 29 '23 02:06 jayvdb