I want to parse TOML files in python 3.9, and I am wondering if I can do so without installing another package.
Since pip
knows how to work with pyproject.toml
files, and I already have pip
installed, does pip
provide a parser that I can import and use in my own code?
For 3.9, pip
vendors tomli:
from pip._vendor import tomli
For consenting adults, importing the vendored module should work as usual. However, this is an implementation detail of pip, and it could change without a deprecation period at any moment in a future release of pip. Therefore, for anything apart from a quick hack, it would be safer to install tomli
(or some other TOML parser) into the site instead.