Forgive me if what I’m going to write feels like ranting; I’ve had this discussion with many people and have many thoughts on this topic.
The number of files does not correlate to “goodness”. Each configuration file is a signal to people reading your repository (including your future self) what tools the project uses. You see
webpack.config.js and you know a project uses Webpack, not (say) Gulp;
pytest.ini for pytest as the designated test runner,
noxfile.py for Nox, etc. Each of the three files in this set-up signals different aspects of your project’s tooling.
pyproject.toml means this is a Python project.
setup.cfg means it is using setuptools for packaging.
setup.py means it also uses setuptools during development (note that you don’t need this file if you don’t call
python setup.py directly; pip recognise
setup.cfg and can run it independently). Can we use only one file? Absolutely. But I’d prefer not doing that, personally.
I do regnoise that a lot of people don’t agree with my preference. And that’s OK, since it’s just a subjective preference. But on the other hand, it is also important to recognise the reasoning behind the preference to multiple configuration files. What a better way means depends on the people who use the tools (and remember, project maintainers are usually the most involved users of the project itself!), and it doesn’t help to complain when you and the tool designers disagree.
If you absolutely can’t stand this “clutter” (as some of my friends put it), there are other tools that may fit your preference. Poetry (mentioned above) and Flit are both alternatives to setuptools, and both of them only use
pyproject.toml as the One Configuration File. (There is also discussion to add
pyproject.toml support to setuptools as well, but don’t hold your breath waiting for it.) But regardless of the tool you choose, it’s only natural to sometimes disagree with the design. We all learn to live with the differences.