Repository navigation
python-config.py should be part of the stdlib #77620
Description
Activity
Rather than (or in addition to) being a standalone script, python-config should be invokable as a stdlib module, e.g. "python -m sysconfig.config". This would prevent the risk of invoking the wrong script on PATH.
Reacted by Erlend E. Aasland- added3.8 (EOL)end of lifeend of lifebuildThe build process and cross-buildThe build process and cross-buildstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
on May 7, 2018 what are the situations where the path for python and python-config is different?
This proposal doesn't say anything how to retrieve the correct information for cross builds using this module. From my point of view, python-config should stay outside the standard library.
En, looks like just only makefile would call python-config.py.
IMHO, if no out user call this script, looks it move to stdlib would be better.I posted on Python-dev (not sure if it will help), I wanted to do this in 2019 but looks like there is still no consensus yet.
It seems it could be moved to sysconfig itself -- the CLI options from python-config would fit there nicely.
Reacted by Erlend E. AaslandYes, this was also proposed here: https://bugs.python.org/issue11602
Misc/python-config.in ultimately becomes a Python script that prints things to stdout. It isn't written to be a module as is. Any work to make it one is effectively writing entirely new code to do what it does.
To keep a single source of truth for
python-configbehavior instead of having two as we do today (as doko noted in bpo-16235), while still exposing the values it provides for use from Python I suggest:- Get rid of the Misc/python-config.in python code.
- Use Misc/python-config.sh.in exclusively.
- Enhancing that to be able to generate a tiny data-only
sysconfig.configuremodule. - Invoke
python-config.sh --generate-sysconfig-bitsduring build time to generate asysconfig/configure.py.
This should reduce the maintenance burden and is kinder to cross-compiliation builds (which we generally are lousy at supporting despite their importance to the world, so our bar today is merely "not regressing").
All that said, in what contexts would having anything that python-config produces today be available from sysconfig be useful?
Reacted by Erlend E. Aasland- added3.12only security fixesonly security fixesand removed3.8 (EOL)end of lifeend of life
on Apr 3, 2023 All that said, in what contexts would having anything that python-config produces today be available from sysconfig be useful?
In contexts where your
pythonX-configcommand doesn't match your Python. For example, in a venv.Reacted by Filipe Laíns, Erlend E. Aasland and Stan Ulbrych- added3.13only security fixesonly security fixesand removed3.12only security fixesonly security fixes
on Jan 5, 2024 - marked python-config code should be in sysconfig #55811 as a duplicate of this issue
on Aug 17, 2025
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: