Our great sponsors
-
pypyr automation task runner
pypyr task-runner cli & api for automation pipelines. Automate anything by combining commands, different scripts in different languages & applications into one pipeline process.
The pypyr automation pipeline task-runner open-source project recently added TOML parsing & writing functionality as a core feature. To this end, I researched the available free & open-source Python TOML parser libraries to figure out which option to use.
-
Of the available options, only tomlkit supports style-preserving roundtrip parsing. Furthermore, tomlkit was created for the express purpose of handling TOML parsing for the poetry tool. As this is one of the 2 most popular new PEP517 & PEP518 Python build systems there is some comfort to be had in the wide adoption of a very actively used tool that means a greater likelihood of continued maintenance & support, and specifically that pyproject.toml files should parse without surprises.
-
Scout APM
Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.
-
tomli Relatively fast read-only parsing. Companion library tomli-w for writing.
-
-
Python wrapper for the toml++ C++ library.
-
toml This was initially vendored in pip itself to deal with pyproject.toml. Even so pip has since moved to tomli.
-
pytoml Abandoned by the creator for eminently sensible reasons (interesting read too... https://github.com/avakar/pytoml/issues/15) But let's not get into an argument over whether a shiny new fashion in config formats is in fact doing anything better than the previous fashions in config management...
-
SonarLint
Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.
-
qtoml Still on TOML v0.5.0.
-
pytomlpp Python wrapper for the toml++ C++ library.
-
rtoml Python wrapper for fast parsing written in Rust.
-
TOMLKit only lists itself as 1.0.0rc1 compliant. Looking at the TOML spec release history delta of rc1 vs v1, it only looks like clarifications & administrative/documentation updates -there doesn't seem to be anything notable missing or functionally different in rc1 as opposed to v1. It's not impossible that I missed something, though - but given TOMLKit's wide usage via poetry, I would expect obvious out-of-date spec handling to have been noticed by someone somewhere, and I see none such in the issues list.
-
Even pip itself has moved from vendoring toml to tomli. This exodus from toml to tomli includes the very prominent:
-
typeshed
-
black
-
mypy
-
coverage
-
flit
-
tomli, then, seems to be where the Python community in general is coalescing for a "standard" TOML parser. tomli is read-only. For write functionality there is the companion library tomli-w.