pants: `python_distribution` should generate PEP 517 and PEP 621 `pyproject.toml` files

The Python packaging ecosystem has been working hard to bring more standardization, such that you don’t “have” to use pip and setuptools.

PEPs 517 and 621 are particularly relevant for metadata for packages. Pants should generate a pyproject.toml rather than setup.py. This allows Pants to be a better community member.

At first, we could have an option that allows users to still generate setup.py like before, and then possibly deprecate that such that we always use PEPs 517 and 621.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 7
  • Comments: 23 (23 by maintainers)

Most upvoted comments

Ah, that is interesting. So before proceeding it would be good to understand the underlying need.

[I should mention (in case it wasn’t clear) that Pants already supports flit and any other PEP-517 backend, with user-authored config. But it will only generate config for you in the form of setup.py, for the legacy setuptools backend.]

So am I right in assuming that the need has to do with mixing generated and handwritten config? You want to use flit, and maybe you already have handwritten config for it, but you don’t want to check in and maintain the parts of the config that Pants already knows about and is capable of generating? (e.g., 3rdparty requirements, figuring out which firstparty sources go in which distribution, etc.)

I ask because if Pants is generating 100% of the config, then it seems, naively, less important to require one PEP-517 backend over another? Since in that case the user isn’t interacting with the backend anyway?