You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After generating _sysconfigdata_*, we could freeze it, like we do to the rest of the standard library.
This should remove the necessity for workarounds such as having to manually set PYTHONPATH to the _sysconfigdata_* directory when running WASM artifacts:
I would like to keep things the same with -Xfrozen_modules=off. Unless the freezing implementation gets too complex, I think it would be better to keep it as a module.
I'd expect the build order to get complex - I'm pretty sure _sysconfigdata gets generated after CPython is built, but to freeze it you need to generate it halfway through the build. All the variables must be available at that point, so it's doable, but it might be a pain.
Then again, having a .py version of the data is no doubt incredibly helpful for some users, as they can get information about an install without having to run it (which may not even be possible). So generating the .py earlier and using the existing freeze infrastructure may be best for everyone.
Although the frozen modules are there to improve startup time, so they have to balance binary size with likelihood of being imported. I don't know that _sysconfigdata gets loaded every time? If it does, then sure, but if it's only imported on occasion then it might be better to keep it totally separate.
I'd expect the build order to get complex - I'm pretty sure _sysconfigdata gets generated after CPython is built, but to freeze it you need to generate it halfway through the build. All the variables must be available at that point, so it's doable, but it might be a pain.
It's not much of a pain really, it just depends on Makefile and pyconfig.h, so we can use the bootstrap or --with-build-python interpreter to run the script that generates _sysconfigdata_*.py.
Then again, having a .py version of the data is no doubt incredibly helpful for some users, as they can get information about an install without having to run it (which may not even be possible). So generating the .py earlier and using the existing freeze infrastructure may be best for everyone.
I am not proposing to remove the .py file. Additionally, we are already shipping a JSON file on POSIX (GH-127302), it shouldn't be difficult to also add this to the Windows build.
Although the frozen modules are there to improve startup time, so they have to balance binary size with likelihood of being imported. I don't know that _sysconfigdata gets loaded every time? If it does, then sure, but if it's only imported on occasion then it might be better to keep it totally separate.
Right, that's a good point. It doesn't get loaded every time. Depending on how folks feel about it, we can either use the existing freeze infrastructure, or split it into an extension.
Activity
zooba commentedon Mar 28, 2025
Is it better to freeze it? Or generate native code to extend
_sysconfigwith the values?FFY00 commentedon Mar 28, 2025
I would like to keep things the same with
-Xfrozen_modules=off. Unless the freezing implementation gets too complex, I think it would be better to keep it as a module.zooba commentedon Mar 31, 2025
I'd expect the build order to get complex - I'm pretty sure
_sysconfigdatagets generated after CPython is built, but to freeze it you need to generate it halfway through the build. All the variables must be available at that point, so it's doable, but it might be a pain.Then again, having a
.pyversion of the data is no doubt incredibly helpful for some users, as they can get information about an install without having to run it (which may not even be possible). So generating the.pyearlier and using the existing freeze infrastructure may be best for everyone.Although the frozen modules are there to improve startup time, so they have to balance binary size with likelihood of being imported. I don't know that
_sysconfigdatagets loaded every time? If it does, then sure, but if it's only imported on occasion then it might be better to keep it totally separate.FFY00 commentedon Apr 1, 2025
It's not much of a pain really, it just depends on
Makefileandpyconfig.h, so we can use the bootstrap or--with-build-pythoninterpreter to run the script that generates_sysconfigdata_*.py.I am not proposing to remove the
.pyfile. Additionally, we are already shipping a JSON file on POSIX (GH-127302), it shouldn't be difficult to also add this to the Windows build.Right, that's a good point. It doesn't get loaded every time. Depending on how folks feel about it, we can either use the existing freeze infrastructure, or split it into an extension.
zooba commentedon Apr 1, 2025
We already have a
_sysconfigextension, so I'd rather see it "split" into there rather than another extension.