Add a hook to get usage information for the `config_settings` parameter of PEP 517 build hooks

Hi all. As some of you may know, PEP 517 allows us to pass a config_settings parameter to build hooks. Pre PEP 517, we were able to do python setup.py --help to see which extra configuration options the backend supports. Right now, the same is not possible because PEP 517 frontends do not have any information.

How do you feel about possibly adding an optional hook to query the backend for usage information? I was envisioning some like

def get_usage_for_build_sdist() -> Dict[str, str]:
    ...

The hook would return a dictionary containing entry keys and the usage description.

As one of the use-cases of this option is to be used by users in the terminal, I believe it would be very valuable to also have usage information available.
Currently, PEP 517 frontends are limited to their own help information, forcing the users to refer to backend documentation, which is generally distributed separately, to find out about this usage information.

A PEP 517 frontend implementation could look something like:

$ python -m build --help-wheel

    universal

         When this option is given, my-super-cool-backend builds a wheel compatible with Python 2 and 3.

...

What do you think? Do you have any alternative suggestions that I perhaps have not considered? Do you see any drawbacks with this approach I am missing? Let me know.

I personally have nothing against it, but consider it a niche need. I tend to specify all my package configuration in config files, so personally don’t see when I’d want to use this :ok_hand:

+1 from me – not sure if this is sufficiently unrelated, but the other thing that I’ve wanted historically is a PEP51X way to get version info, i.e. python setup.py --version, for which as far as I know, there also isn’t a generic way to do so from a frontend.

But yeah definitely +1 on more metadata exposed generically personally.

@Julian: You can get the version with:

twine feature/bye-bye-pkg_resources $ pip-run -q pep517 -- -c "import pep517.meta; print(pep517.meta.load('.').metadata['Version'])"
3.3.1.dev11+g743f162
1 Like

Addressing the original request:

Yes, it seems useful. I’ve not yet encountered a situation where I’ve used config settings, and I’m not confident that Setuptools even has a good story for config settings, so I don’t feel strongly about it. The biggest challenge is going to be transitioning from an optional API to a recommended/required API. But I’ve no strong objections.