On 2020-01-08 17:53, Victor Stinner wrote:
Hi,
I dislike python-config for multiple reasons
You may get the wrong information if you pick the wrong python-config script :-(
IMHO we should add a new module (problem: how should it be called? pyconfig?) which could be used using "python3 -m xxx ...". There is a similar discussion between "pip ..." and "python3 -m pip ..." commands: I understand that "python3 -m pip ..." is more reliable to know which Python will be picked, especially in a virtual environment.
Indeed. It's a bad idea to have separate executables that use/affect "the Python" or are needed to work with "the Python", but don't precisely specify "the Python". And `python -m ...` is the most sane way out of the mess.
There are two implementations: one in Python used on macOS, one in shell used on other platforms.
Moreover, if it's implemented in the stdlib, it can be implemented in Python and it should be easier to maintain than a shell script. For example, python-config has no unit test...
Could sysconfig be extended? Currently it doesn't respond to CLI flags; it should be possible to add config-like ones, e.g.: python -m sysconfig --libs python -m sysconfig --help Would that help? I must admit I don't really understand python-config. Does anyone know its purpose? History? Documentation? One thing I suspect is that it was meant as a helper for pkg-config, not to be used alone.