10

Should I be using only pyproject.toml or use it with setup.py and setup.cfg? Or perhaps some other combination of them.

I can't find any definitive answer to this question so I'd be pleased if someone could enlighten the matter.

paavoto
  • 127
  • 4
  • I think the only answer is "not yet". `pyproject.toml` is *intended* to be a tool-agnostic file, but not all tools support it, and I don't think most code bases *need* to be tool-agnostic. (If you or your organization always uses `pip`, then there's no need to support `poetry`, for example.) – chepner Aug 10 '22 at 17:09
  • 1
    Depends on your needs. If you support only modern systems (no EOL versions) and only PEP660 enabled backends (no setuptools [yet](https://github.com/pypa/setuptools/pull/3488), so I doubt it is your case) - you may go with pyproject.toml only, but users won't like this. But you can keep all configuration in `pyproject.toml` and use one-liner as setup.py (no setup.cfg; in setup.py just `import setuptools; setuptools.setup()`). – STerliakov Aug 10 '22 at 17:11
  • 2
    Yes. As of today, I would definitely recommend the default to be `pyproject.toml`. If your project stumbles unto something that prevents from using `pyproject.toml`, then fall back to something else, but there are less and less hold-offs by the day. Even _setuptools_ can be used with `pyproject.toml` only (without `setup.cfg` and `setup.py`). – sinoroc Aug 10 '22 at 22:03
  • related: https://stackoverflow.com/q/44878600, https://stackoverflow.com/q/62983756 – djvg Dec 13 '22 at 16:28
  • Does this answer your question? [What are the downsides to relying purely on pyproject.toml?](https://stackoverflow.com/questions/75588250/what-are-the-downsides-to-relying-purely-on-pyproject-toml) – Gino Mempin Feb 28 '23 at 09:56

0 Answers0