Python standard library TOML module
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
import toml # deserialization toml.dumps({'bar': [{'foo': 'salute'}]}) '[[bar]]\nfoo = "salute"\n' # serialization toml.loads('foo = ""\nbar = ["bar", "", "1.0", "2"]') {'foo': '', 'bar': ['bar', '', '1.0', '2']}
Pleased to listen your opinions on this
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.
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:
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. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/B5T6TM... Code of Conduct: http://python.org/psf/codeofconduct/
-- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
There is already some info/discussion over on the bug tracker: https://bugs.python.org/issue40059 Sebastian
Yes!! This is something I've thought about proposing for a while, but I was too lazy to do it. TOML is a wonderful language with an important place in the Python ecosystem. -- Finn (Mobile) On Fri, Dec 10, 2021, 9:57 AM Sebastian Koslowski < sebastian.koslowski@gmail.com> wrote:
There is already some info/discussion over on the bug tracker:
https://bugs.python.org/issue40059
Sebastian _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZQOD6T... Code of Conduct: http://python.org/psf/codeofconduct/
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.
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:
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. _______________________________________________ Python-ideas mailing list -- python...@python.org To unsubscribe send an email to python-id...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python...@python.org/message/SDAJ4DCK7... <https://mail.python.org/archives/list/python-ideas@python.org/message/SDAJ4DCK7GJIMEONNYJ3NNXKJYGQWJDF/> Code of Conduct: http://python.org/psf/codeofconduct/
participants (7)
-
Christopher Barker
-
Finn Mason
-
Martin Reboredo
-
Neil Girdhar
-
Pradyun Gedam
-
Sebastian Koslowski
-
Valentin Berlier