Python standard library TOML module
![](https://secure.gravatar.com/avatar/a1c254c6ecd4a9965108e32fee2ef401.jpg?s=120&d=mm&r=g)
Title: Python standard library TOML module Hello everyone, ITT I propose the idea of a TOML module in the standard library for general TOML operations. The main motivator of this is the growing adoption of PEP 517. Recently I've been following its developments and I've noticed some situations that could make things a bit harder at the moment of working with build systems based on it. Namely I saw that dependency problems like cycles or complicated dependency graphs. For instance, we have a build system module that depends on a TOML module and the latter depends on the former or on another build system, leading to square one. Chicken and egg scenarios could also be conceived as a consequence of not having an included TOML module for operations with the pyproject.toml file. The inclusion of a TOML module in the standard library can solve this kind of scenarios by providing an API for TOML deserialization and serialization. I also propose that the module API can modeled around the existing json module from the stdlib just to make design and usage easier. Some snippets the module in action: ```python
Pleased to listen your opinions on this
![](https://secure.gravatar.com/avatar/789af6570917775dcffef3122da94423.jpg?s=120&d=mm&r=g)
Yes. This is desperately needed. Usually I'm not a big fan of adding new standard library modules but in this case since toml is becoming such a critical part of packaging it seems like a no-brainer.
![](https://secure.gravatar.com/avatar/176220408ba450411279916772c36066.jpg?s=120&d=mm&r=g)
Yes please! It always seemed very odd to me that the standard packaging system would require a non-standard library. Surely TOML is stable enough by now? -CHB On Fri, Dec 10, 2021 at 4:06 AM Valentin Berlier <berlier.v@gmail.com> wrote:
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
![](https://secure.gravatar.com/avatar/3a0a681a96d51af563d8278c21ba68a5.jpg?s=120&d=mm&r=g)
There is already some info/discussion over on the bug tracker: https://bugs.python.org/issue40059 Sebastian
![](https://secure.gravatar.com/avatar/d3730fddd0356d346ffcd7e4f7a7abad.jpg?s=120&d=mm&r=g)
The line of reasoning for the packaging tooling choosing TOML is elaborated upon in PEP 518 (https://www.python.org/dev/peps/pep-0518/#other-file-formats) and that choice was informed by a survey of the existing formats: https://gist.github.com/njsmith/78f68204c5d969f8c8bc645ef77d4a8f.
![](https://secure.gravatar.com/avatar/0f393da4b8265592816178e5ff6c1c62.jpg?s=120&d=mm&r=g)
FYI: The flake8 project refuses to add toml configuration file support in part because there is no standard library toml module: https://github.com/PyCQA/flake8/issues/234#issuecomment-812800722 The thread was eventually locked by the project owner, and a project sprang up to try to address the issue: https://github.com/csachs/pyproject-flake8 Best, Neil On Saturday, December 11, 2021 at 11:57:24 AM UTC-5 Pradyun Gedam wrote:
![](https://secure.gravatar.com/avatar/789af6570917775dcffef3122da94423.jpg?s=120&d=mm&r=g)
Yes. This is desperately needed. Usually I'm not a big fan of adding new standard library modules but in this case since toml is becoming such a critical part of packaging it seems like a no-brainer.
![](https://secure.gravatar.com/avatar/176220408ba450411279916772c36066.jpg?s=120&d=mm&r=g)
Yes please! It always seemed very odd to me that the standard packaging system would require a non-standard library. Surely TOML is stable enough by now? -CHB On Fri, Dec 10, 2021 at 4:06 AM Valentin Berlier <berlier.v@gmail.com> wrote:
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
![](https://secure.gravatar.com/avatar/3a0a681a96d51af563d8278c21ba68a5.jpg?s=120&d=mm&r=g)
There is already some info/discussion over on the bug tracker: https://bugs.python.org/issue40059 Sebastian
![](https://secure.gravatar.com/avatar/d3730fddd0356d346ffcd7e4f7a7abad.jpg?s=120&d=mm&r=g)
The line of reasoning for the packaging tooling choosing TOML is elaborated upon in PEP 518 (https://www.python.org/dev/peps/pep-0518/#other-file-formats) and that choice was informed by a survey of the existing formats: https://gist.github.com/njsmith/78f68204c5d969f8c8bc645ef77d4a8f.
![](https://secure.gravatar.com/avatar/0f393da4b8265592816178e5ff6c1c62.jpg?s=120&d=mm&r=g)
FYI: The flake8 project refuses to add toml configuration file support in part because there is no standard library toml module: https://github.com/PyCQA/flake8/issues/234#issuecomment-812800722 The thread was eventually locked by the project owner, and a project sprang up to try to address the issue: https://github.com/csachs/pyproject-flake8 Best, Neil On Saturday, December 11, 2021 at 11:57:24 AM UTC-5 Pradyun Gedam wrote:
participants (7)
-
Christopher Barker
-
Finn Mason
-
Martin Reboredo
-
Neil Girdhar
-
Pradyun Gedam
-
Sebastian Koslowski
-
Valentin Berlier