Originally reported by pradyunsg (Bitbucket: pradyunsg, GitHub: pradyunsg)
As per PEP 518, tools can use tool.<pypi-name> namespace within the pyproject.toml file if they own <pypi-name> on PyPI.
Allowing configuration via the above mechanism would allow for users to have a single file in their root directory, for configuring this coverage (and other tools) for their project. Essentially, this would allow eliminating a .coveragerc file in the root of the project in favor of using pyproject.toml.
This is a good idea. One twist: coverage.py has no required dependencies. It will need a toml parser to parse the pyproject.toml file. My inclination is to implement this so that if the toml module is available, then coverage will try to read the pyproject.toml file. Installing coverage won't install toml automatically, you'll have to do that yourself if you want to use pyproject.toml for configuration.
@nedbat What about vendoring the toml library along with coverage? Would you be ok with that approach? Some projects do that (I think Pipenv does that with Pip, although there are probably examples in less chaotic projects as well [that's not to say that Pipenv is bad] ), to stay independent of other dependencies, and act as a self-contained dependency.
Or on the other hand... your solution seems more sensible :) Just have to document that.
You can also list it as optional dependency.
+1 for optional dependency, isort does that for example: pip install isort[pyproject].
This is finished as of df744f8cbcad7ea7dca893be5017920afa4ce32f
Awesome, @nedbat thanks for helping move this along. Assume this will land in the next release?
Yes, if by next release you mean 5.0.
This is available in 5.0b1: https://pypi.org/project/coverage/5.0b1/
Most helpful comment
This is a good idea. One twist: coverage.py has no required dependencies. It will need a toml parser to parse the pyproject.toml file. My inclination is to implement this so that if the toml module is available, then coverage will try to read the pyproject.toml file. Installing coverage won't install toml automatically, you'll have to do that yourself if you want to use pyproject.toml for configuration.