question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion: support for pyproject.toml configuration

See original GitHub issue

Over the last few months, I’ve been using setup.cfg more, and I find the syntax and types and such to be super counter-intuitive. I don’t find TOML to be a breeze per se, but it’s at least a lot clearer to me how to specify a string, a list, etc. We also hear a lot of cries to move towards supporting pyproject.toml as the “one file” for setup configuration, in favor of setup.cfg. I’m not terribly opposed to this, but I want to open up the discussion for a few options:

  1. Add pyproject.toml as the one true way to do declarative builds, moving all setuptools configuration over there and deprecating setup.cfg (partially what is discussed in #1160, and if we decide on that option we can move over to that issue).
  2. Add pyproject.toml as a second supported way to do a declarative configuration, alongside setup.cfg.
  3. Stay the course with setup.cfg indefinitely.

I am deeply concerned with the large amount of churn that we’re introducing into the Python packaging space, so I don’t want to make a lot of changes for the sake of changes, but I do think that at least having the option to use a pyproject.toml would be a real benefit, so I’m basically in favor of option 2.

I think the biggest downside of option 2 is that it means maintaining, testing and documenting three separate locations for all of our options - how to do it in setup.cfg, how to do it in pyproject.toml, and how to do it in setup.py. I think the hard part is going from 1 way to do everything to 2 ways. Our documentation is a mess anyway, but my beautiful vision for the future is that all our examples have “tabs” that allow you to toggle them between setup.cfg and setup.py. Adding a pyproject.toml in there would probably not be the worst thing.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:73
  • Comments:64 (33 by maintainers)

github_iconTop GitHub Comments

13reactions
nschloecommented, Nov 24, 2020

FWIW, PEP 621 for Storing project metadata in pyproject.toml has been provisionally accepted.

12reactions
jaracocommented, Mar 9, 2019

I’d prefer option 1. I imagine during the deprecation period that the setup.cfg documentation could be removed, but a permalink to the old documentation made available for projects still relying on that technique.

One way to ease the transition could be for the setup.cfg code to generate a .toml file and consume then have the pyproject.toml consumer just load both files. That way, a project seeking to transition would only need to do one build, manually merge the two .toml files, and delete setup.cfg.

My second choice would be option 3. I’d really like to avoid supporting multiple formats that do essentially the same thing.

Another consideration I’d like to mention is the proposal I only recently started fleshing out in pypa/packaging-problems#248. Such an approach would be yet another declarative format. However, this proposed approach would enable project developers to supply metadata decoratively in the canonical format (or in a format suitable for the requisite build steps). If such an approach is deemed viable and comes to fruition, the value in migrating to pyproject.toml may prove small. I suggest postponing this transition at least until that more ambitious proposal is disposed or reaches fruition.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where to get started with pyproject.toml? - Python Help
Hey all, I have toi create a new Python package so I thought, for once, I'd try to be doing the right thing...
Read more >
Python third-party tools configuration: pyproject.toml vs setup.cfg
TOML is a great human-readable, machine-editable, strong typed, well-defined configuration format. Having Python- and setuptools-independent ...
Read more >
Flake8-pyproject - PyPI
Flake8 cannot be configured via pyproject.toml , even though virtually all other Python dev tools have adopted it as the central location for...
Read more >
Understanding setup.py, setup.cfg and pyproject.toml in Python
The pyproject.toml file was introduced in PEP-518 (2016) as a way of separating configuration of the build system from a specific, optional ...
Read more >
Configuring setuptools using pyproject.toml files
Starting with PEP 621, the Python community selected pyproject.toml as a standard way of specifying project metadata. Setuptools has adopted this standard and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found