CINXE.COM
PEP 680 – tomllib: Support for Parsing TOML in the Standard Library | peps.python.org
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="color-scheme" content="light dark"> <title>PEP 680 – tomllib: Support for Parsing TOML in the Standard Library | peps.python.org</title> <link rel="shortcut icon" href="../_static/py.png"> <link rel="canonical" href="https://peps.python.org/pep-0680/"> <link rel="stylesheet" href="../_static/style.css" type="text/css"> <link rel="stylesheet" href="../_static/mq.css" type="text/css"> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" media="(prefers-color-scheme: light)" id="pyg-light"> <link rel="stylesheet" href="../_static/pygments_dark.css" type="text/css" media="(prefers-color-scheme: dark)" id="pyg-dark"> <link rel="alternate" type="application/rss+xml" title="Latest PEPs" href="https://peps.python.org/peps.rss"> <meta property="og:title" content='PEP 680 – tomllib: Support for Parsing TOML in the Standard Library | peps.python.org'> <meta property="og:description" content="This PEP proposes adding the tomllib module to the standard library for parsing TOML (Tom’s Obvious Minimal Language, https://toml.io)."> <meta property="og:type" content="website"> <meta property="og:url" content="https://peps.python.org/pep-0680/"> <meta property="og:site_name" content="Python Enhancement Proposals (PEPs)"> <meta property="og:image" content="https://peps.python.org/_static/og-image.png"> <meta property="og:image:alt" content="Python PEPs"> <meta property="og:image:width" content="200"> <meta property="og:image:height" content="200"> <meta name="description" content="This PEP proposes adding the tomllib module to the standard library for parsing TOML (Tom’s Obvious Minimal Language, https://toml.io)."> <meta name="theme-color" content="#3776ab"> </head> <body> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="svg-sun-half" viewBox="0 0 24 24" pointer-events="all"> <title>Following system colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="9"></circle> <path d="M12 3v18m0-12l4.65-4.65M12 14.3l7.37-7.37M12 19.6l8.85-8.85"></path> </svg> </symbol> <symbol id="svg-moon" viewBox="0 0 24 24" pointer-events="all"> <title>Selected dark colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z"></path> </svg> </symbol> <symbol id="svg-sun" viewBox="0 0 24 24" pointer-events="all"> <title>Selected light colour scheme</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <circle cx="12" cy="12" r="5"></circle> <line x1="12" y1="1" x2="12" y2="3"></line> <line x1="12" y1="21" x2="12" y2="23"></line> <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> <line x1="1" y1="12" x2="3" y2="12"></line> <line x1="21" y1="12" x2="23" y2="12"></line> <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> </svg> </symbol> </svg> <script> document.documentElement.dataset.colour_scheme = localStorage.getItem("colour_scheme") || "auto" </script> <section id="pep-page-section"> <header> <h1>Python Enhancement Proposals</h1> <ul class="breadcrumbs"> <li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> » </li> <li><a href="../pep-0000/">PEP Index</a> » </li> <li>PEP 680</li> </ul> <button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())"> <svg aria-hidden="true" class="colour-scheme-icon-when-auto"><use href="#svg-sun-half"></use></svg> <svg aria-hidden="true" class="colour-scheme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg aria-hidden="true" class="colour-scheme-icon-when-light"><use href="#svg-sun"></use></svg> <span class="visually-hidden">Toggle light / dark / auto colour theme</span> </button> </header> <article> <section id="pep-content"> <h1 class="page-title">PEP 680 – tomllib: Support for Parsing TOML in the Standard Library</h1> <dl class="rfc2822 field-list simple"> <dt class="field-odd">Author<span class="colon">:</span></dt> <dd class="field-odd">Taneli Hukkinen, Shantanu Jain <hauntsaninja at gmail.com></dd> <dt class="field-even">Sponsor<span class="colon">:</span></dt> <dd class="field-even">Petr Viktorin <encukou at gmail.com></dd> <dt class="field-odd">Discussions-To<span class="colon">:</span></dt> <dd class="field-odd"><a class="reference external" href="https://discuss.python.org/t/13040">Discourse thread</a></dd> <dt class="field-even">Status<span class="colon">:</span></dt> <dd class="field-even"><abbr title="Accepted and implementation complete, or no longer active">Final</abbr></dd> <dt class="field-odd">Type<span class="colon">:</span></dt> <dd class="field-odd"><abbr title="Normative PEP with a new feature for Python, implementation change for CPython or interoperability standard for the ecosystem">Standards Track</abbr></dd> <dt class="field-even">Created<span class="colon">:</span></dt> <dd class="field-even">01-Jan-2022</dd> <dt class="field-odd">Python-Version<span class="colon">:</span></dt> <dd class="field-odd">3.11</dd> <dt class="field-even">Post-History<span class="colon">:</span></dt> <dd class="field-even"><a class="reference external" href="https://mail.python.org/archives/list/python-ideas@python.org/thread/IWJ3I32A4TY6CIVQ6ONPEBPWP4TOV2V7/" title="Python-Ideas thread">09-Dec-2021</a>, <a class="reference external" href="https://discuss.python.org/t/pep-680-tomllib-support-for-parsing-toml-in-the-standard-library/13040" title="Discourse thread">27-Jan-2022</a></dd> <dt class="field-odd">Resolution<span class="colon">:</span></dt> <dd class="field-odd"><a class="reference external" href="https://mail.python.org/archives/list/python-dev@python.org/thread/3AHGWYY562HHO55L4Z2OVYUFZP5W73IS/">Python-Dev thread</a></dd> </dl> <hr class="docutils" /> <section id="contents"> <details><summary>Table of Contents</summary><ul class="simple"> <li><a class="reference internal" href="#abstract">Abstract</a></li> <li><a class="reference internal" href="#motivation">Motivation</a></li> <li><a class="reference internal" href="#rationale">Rationale</a></li> <li><a class="reference internal" href="#specification">Specification</a></li> <li><a class="reference internal" href="#maintenance-implications">Maintenance Implications</a><ul> <li><a class="reference internal" href="#stability-of-toml">Stability of TOML</a></li> <li><a class="reference internal" href="#maintainability-of-proposed-implementation">Maintainability of proposed implementation</a></li> <li><a class="reference internal" href="#toml-support-a-slippery-slope-for-other-things">TOML support a slippery slope for other things</a></li> </ul> </li> <li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li> <li><a class="reference internal" href="#security-implications">Security Implications</a></li> <li><a class="reference internal" href="#how-to-teach-this">How to Teach This</a></li> <li><a class="reference internal" href="#reference-implementation">Reference Implementation</a></li> <li><a class="reference internal" href="#rejected-ideas">Rejected Ideas</a><ul> <li><a class="reference internal" href="#basing-on-another-toml-implementation">Basing on another TOML implementation</a></li> <li><a class="reference internal" href="#including-an-api-for-writing-toml">Including an API for writing TOML</a></li> <li><a class="reference internal" href="#assorted-api-details">Assorted API details</a><ul> <li><a class="reference internal" href="#types-accepted-as-the-first-argument-of-tomllib-load">Types accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.load</span></code></a></li> <li><a class="reference internal" href="#type-accepted-as-the-first-argument-of-tomllib-loads">Type accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#controlling-the-type-of-mappings-returned-by-tomllib-load-s">Controlling the type of mappings returned by <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></li> <li><a class="reference internal" href="#removing-support-for-parse-float-in-tomllib-load-s">Removing support for <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> in <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></li> <li><a class="reference internal" href="#alternative-names-for-the-module">Alternative names for the module</a></li> </ul> </li> <li><a class="reference internal" href="#previous-discussion">Previous Discussion</a></li> <li><a class="reference internal" href="#appendix-a-differences-between-proposed-api-and-toml">Appendix A: Differences between proposed API and <code class="docutils literal notranslate"><span class="pre">toml</span></code></a></li> <li><a class="reference internal" href="#copyright">Copyright</a></li> </ul> </details></section> <div class="pep-banner canonical-doc sticky-banner admonition important"> <p class="admonition-title">Important</p> <p>This PEP is a historical document. The up-to-date, canonical documentation can now be found at <a class="reference external" href="https://docs.python.org/3/library/tomllib.html#module-tomllib" title="(in Python v3.13)"><code class="docutils literal notranslate"><span class="pre">tomllib</span></code></a>.</p> <p class="close-button">×</p> <p>See <a class="pep reference internal" href="../pep-0001/" title="PEP 1 – PEP Purpose and Guidelines">PEP 1</a> for how to propose changes.</p> </div> <section id="abstract"> <h2><a class="toc-backref" href="#abstract" role="doc-backlink">Abstract</a></h2> <p>This PEP proposes adding the <code class="docutils literal notranslate"><span class="pre">tomllib</span></code> module to the standard library for parsing TOML (Tom’s Obvious Minimal Language, <a class="reference external" href="https://toml.io/en/">https://toml.io</a>).</p> </section> <section id="motivation"> <h2><a class="toc-backref" href="#motivation" role="doc-backlink">Motivation</a></h2> <p>TOML is the format of choice for Python packaging, as evidenced by <a class="pep reference internal" href="../pep-0517/" title="PEP 517 – A build-system independent format for source trees">PEP 517</a>, <a class="pep reference internal" href="../pep-0518/" title="PEP 518 – Specifying Minimum Build System Requirements for Python Projects">PEP 518</a> and <a class="pep reference internal" href="../pep-0621/" title="PEP 621 – Storing project metadata in pyproject.toml">PEP 621</a>. This creates a bootstrapping problem for Python build tools, forcing them to vendor a TOML parsing package or employ other undesirable workarounds, and causes serious issues for repackagers and other downstream consumers. Including TOML support in the standard library would neatly solve all of these issues.</p> <p>Further, many Python tools are now configurable via TOML, such as <code class="docutils literal notranslate"><span class="pre">black</span></code>, <code class="docutils literal notranslate"><span class="pre">mypy</span></code>, <code class="docutils literal notranslate"><span class="pre">pytest</span></code>, <code class="docutils literal notranslate"><span class="pre">tox</span></code>, <code class="docutils literal notranslate"><span class="pre">pylint</span></code> and <code class="docutils literal notranslate"><span class="pre">isort</span></code>. Many that are not, such as <code class="docutils literal notranslate"><span class="pre">flake8</span></code>, cite the lack of standard library support as a <a class="reference external" href="https://github.com/PyCQA/flake8/issues/234#issuecomment-812800722">main reason why</a>. Given the special place TOML already has in the Python ecosystem, it makes sense for it to be an included battery.</p> <p>Finally, TOML as a format is increasingly popular (for the reasons outlined in <a class="pep reference internal" href="../pep-0518/" title="PEP 518 – Specifying Minimum Build System Requirements for Python Projects">PEP 518</a>), with various Python TOML libraries having about 2000 reverse dependencies on PyPI (for comparison, <code class="docutils literal notranslate"><span class="pre">requests</span></code> has about 28000 reverse dependencies). Hence, this is likely to be a generally useful addition, even looking beyond the needs of Python packaging and related tools.</p> </section> <section id="rationale"> <h2><a class="toc-backref" href="#rationale" role="doc-backlink">Rationale</a></h2> <p>This PEP proposes basing the standard library support for reading TOML on the third-party library <code class="docutils literal notranslate"><span class="pre">tomli</span></code> (<a class="reference external" href="https://github.com/hukkin/tomli">github.com/hukkin/tomli</a>).</p> <p>Many projects have recently switched to using <code class="docutils literal notranslate"><span class="pre">tomli</span></code>, such as <code class="docutils literal notranslate"><span class="pre">pip</span></code>, <code class="docutils literal notranslate"><span class="pre">build</span></code>, <code class="docutils literal notranslate"><span class="pre">pytest</span></code>, <code class="docutils literal notranslate"><span class="pre">mypy</span></code>, <code class="docutils literal notranslate"><span class="pre">black</span></code>, <code class="docutils literal notranslate"><span class="pre">flit</span></code>, <code class="docutils literal notranslate"><span class="pre">coverage</span></code>, <code class="docutils literal notranslate"><span class="pre">setuptools-scm</span></code> and <code class="docutils literal notranslate"><span class="pre">cibuildwheel</span></code>.</p> <p><code class="docutils literal notranslate"><span class="pre">tomli</span></code> is actively maintained and well-tested. It is about 800 lines of code with 100% test coverage, and passes all tests in the <a class="reference external" href="https://github.com/toml-lang/compliance/pull/8">proposed official TOML compliance test suite</a>, as well as <a class="reference external" href="https://github.com/BurntSushi/toml-test">the more established BurntSushi/toml-test suite</a>.</p> </section> <section id="specification"> <h2><a class="toc-backref" href="#specification" role="doc-backlink">Specification</a></h2> <p>A new module <code class="docutils literal notranslate"><span class="pre">tomllib</span></code> will be added to the Python standard library, exposing the following public functions:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">load</span><span class="p">(</span> <span class="n">fp</span><span class="p">:</span> <span class="n">SupportsRead</span><span class="p">[</span><span class="nb">bytes</span><span class="p">],</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">parse_float</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[</span><span class="nb">str</span><span class="p">],</span> <span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]:</span> <span class="o">...</span> <span class="k">def</span><span class="w"> </span><span class="nf">loads</span><span class="p">(</span> <span class="n">s</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">/</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">parse_float</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[</span><span class="nb">str</span><span class="p">],</span> <span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]:</span> <span class="o">...</span> </pre></div> </div> <p><code class="docutils literal notranslate"><span class="pre">tomllib.load</span></code> deserializes a binary file-like object containing a TOML document to a Python <code class="docutils literal notranslate"><span class="pre">dict</span></code>. The <code class="docutils literal notranslate"><span class="pre">fp</span></code> argument must have a <code class="docutils literal notranslate"><span class="pre">read()</span></code> method with the same API as <code class="docutils literal notranslate"><span class="pre">io.RawIOBase.read()</span></code>.</p> <p><code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code> deserializes a <code class="docutils literal notranslate"><span class="pre">str</span></code> instance containing a TOML document to a Python <code class="docutils literal notranslate"><span class="pre">dict</span></code>.</p> <p>The <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> argument is a callable object that takes as input the original string representation of a TOML float, and returns a corresponding Python object (similar to <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> in <code class="docutils literal notranslate"><span class="pre">json.load</span></code>). For example, the user may pass a function returning a <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code>, for use cases where exact precision is important. By default, TOML floats are parsed as instances of the Python <code class="docutils literal notranslate"><span class="pre">float</span></code> type.</p> <p>The returned object contains only basic Python objects (<code class="docutils literal notranslate"><span class="pre">str</span></code>, <code class="docutils literal notranslate"><span class="pre">int</span></code>, <code class="docutils literal notranslate"><span class="pre">bool</span></code>, <code class="docutils literal notranslate"><span class="pre">float</span></code>, <code class="docutils literal notranslate"><span class="pre">datetime.{datetime,date,time}</span></code>, <code class="docutils literal notranslate"><span class="pre">list</span></code>, <code class="docutils literal notranslate"><span class="pre">dict</span></code> with string keys), and the results of <code class="docutils literal notranslate"><span class="pre">parse_float</span></code>.</p> <p><code class="docutils literal notranslate"><span class="pre">tomllib.TOMLDecodeError</span></code> is raised in the case of invalid TOML.</p> <p>Note that this PEP does not propose <code class="docutils literal notranslate"><span class="pre">tomllib.dump</span></code> or <code class="docutils literal notranslate"><span class="pre">tomllib.dumps</span></code> functions; see <a class="reference internal" href="#including-an-api-for-writing-toml">Including an API for writing TOML</a> for details.</p> </section> <section id="maintenance-implications"> <h2><a class="toc-backref" href="#maintenance-implications" role="doc-backlink">Maintenance Implications</a></h2> <section id="stability-of-toml"> <h3><a class="toc-backref" href="#stability-of-toml" role="doc-backlink">Stability of TOML</a></h3> <p>The release of TOML 1.0.0 in January 2021 indicates the TOML format should now be officially considered stable. Empirically, TOML has proven to be a stable format even prior to the release of TOML 1.0.0. From the <a class="reference external" href="https://github.com/toml-lang/toml/blob/master/CHANGELOG.md">changelog</a>, we can see that TOML has had no major changes since April 2020, and has had two releases in the past five years (2017-2021).</p> <p>In the event of changes to the TOML specification, we can treat minor revisions as bug fixes and update the implementation in place. In the event of major breaking changes, we should preserve support for TOML 1.x.</p> </section> <section id="maintainability-of-proposed-implementation"> <h3><a class="toc-backref" href="#maintainability-of-proposed-implementation" role="doc-backlink">Maintainability of proposed implementation</a></h3> <p>The proposed implementation (<code class="docutils literal notranslate"><span class="pre">tomli</span></code>) is pure Python, well tested and weighs in at under 1000 lines of code. It is minimalist, offering a smaller API surface area than other TOML implementations.</p> <p>The author of <code class="docutils literal notranslate"><span class="pre">tomli</span></code> is willing to help integrate <code class="docutils literal notranslate"><span class="pre">tomli</span></code> into the standard library and help maintain it, <a class="reference external" href="https://github.com/hukkin/tomli/issues/141#issuecomment-998018972">as per this post</a>. Furthermore, Python core developer Petr Viktorin has indicated a willingness to maintain a read API, <a class="reference external" href="https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068/88">as per this post</a>.</p> <p>Rewriting the parser in C is not deemed necessary at this time. It is rare for TOML parsing to be a bottleneck in applications, and users with higher performance needs can use a third-party library (as is already often the case with JSON, despite Python offering a standard library C-extension module).</p> </section> <section id="toml-support-a-slippery-slope-for-other-things"> <h3><a class="toc-backref" href="#toml-support-a-slippery-slope-for-other-things" role="doc-backlink">TOML support a slippery slope for other things</a></h3> <p>As discussed in the <a class="reference internal" href="#motivation">Motivation</a> section, TOML holds a special place in the Python ecosystem, for reading <a class="pep reference internal" href="../pep-0518/" title="PEP 518 – Specifying Minimum Build System Requirements for Python Projects">PEP 518</a> <code class="docutils literal notranslate"><span class="pre">pyproject.toml</span></code> packaging and tool configuration files. This chief reason to include TOML in the standard library does not apply to other formats, such as YAML or MessagePack.</p> <p>In addition, the simplicity of TOML distinguishes it from other formats like YAML, which are highly complicated to construct and parse.</p> <p>An API for writing TOML may, however, be added in a future PEP.</p> </section> </section> <section id="backwards-compatibility"> <h2><a class="toc-backref" href="#backwards-compatibility" role="doc-backlink">Backwards Compatibility</a></h2> <p>This proposal has no backwards compatibility issues within the standard library, as it describes a new module. Any existing third-party module named <code class="docutils literal notranslate"><span class="pre">tomllib</span></code> will break, as <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">tomllib</span></code> will import the standard library module. However, <code class="docutils literal notranslate"><span class="pre">tomllib</span></code> is not registered on PyPI, so it is unlikely that any module with this name is widely used.</p> <p>Note that we avoid using the more straightforward name <code class="docutils literal notranslate"><span class="pre">toml</span></code> to avoid backwards compatibility implications for users who have pinned versions of the current <code class="docutils literal notranslate"><span class="pre">toml</span></code> PyPI package. For more details, see the <a class="reference internal" href="#alternative-names-for-the-module">Alternative names for the module</a> section.</p> </section> <section id="security-implications"> <h2><a class="toc-backref" href="#security-implications" role="doc-backlink">Security Implications</a></h2> <p>Errors in the implementation could cause potential security issues. However, the parser’s output is limited to simple data types; inability to load arbitrary classes avoids security issues common in more “powerful” formats like pickle and YAML. Also, the implementation will be in pure Python, which reduces security issues endemic to C, such as buffer overflows.</p> </section> <section id="how-to-teach-this"> <h2><a class="toc-backref" href="#how-to-teach-this" role="doc-backlink">How to Teach This</a></h2> <p>The API of <code class="docutils literal notranslate"><span class="pre">tomllib</span></code> mimics that of other well-established file format libraries, such as <code class="docutils literal notranslate"><span class="pre">json</span></code> and <code class="docutils literal notranslate"><span class="pre">pickle</span></code>. The lack of a <code class="docutils literal notranslate"><span class="pre">dump</span></code> function will be explained in the documentation, with a link to relevant third-party libraries (e.g. <code class="docutils literal notranslate"><span class="pre">tomlkit</span></code>, <code class="docutils literal notranslate"><span class="pre">tomli-w</span></code>, <code class="docutils literal notranslate"><span class="pre">pytomlpp</span></code>).</p> </section> <section id="reference-implementation"> <h2><a class="toc-backref" href="#reference-implementation" role="doc-backlink">Reference Implementation</a></h2> <p>The proposed implementation can be found at <a class="reference external" href="https://github.com/hukkin/tomli">https://github.com/hukkin/tomli</a></p> </section> <section id="rejected-ideas"> <h2><a class="toc-backref" href="#rejected-ideas" role="doc-backlink">Rejected Ideas</a></h2> <section id="basing-on-another-toml-implementation"> <h3><a class="toc-backref" href="#basing-on-another-toml-implementation" role="doc-backlink">Basing on another TOML implementation</a></h3> <p>Several potential alternative implementations exist:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">tomlkit</span></code> is well established, actively maintained and supports TOML 1.0.0. An important difference is that <code class="docutils literal notranslate"><span class="pre">tomlkit</span></code> supports style roundtripping. As a result, it has a more complex API and implementation (about 5x as much code as <code class="docutils literal notranslate"><span class="pre">tomli</span></code>). Its author does not believe that <code class="docutils literal notranslate"><span class="pre">tomlkit</span></code> is a good choice for the standard library.</li> <li><code class="docutils literal notranslate"><span class="pre">toml</span></code> is a very widely used library. However, it is not actively maintained, does not support TOML 1.0.0 and has a number of known bugs. Its API is more complex than that of <code class="docutils literal notranslate"><span class="pre">tomli</span></code>. It allows customising output style through a complicated encoder API, and some very limited and mostly unused functionality to preserve input style through an undocumented decoder API. For more details on its API differences from this PEP, refer to <a class="reference internal" href="#pep-680-appendix-a">Appendix A</a>.</li> <li><code class="docutils literal notranslate"><span class="pre">pytomlpp</span></code> is a Python wrapper for the C++ project <code class="docutils literal notranslate"><span class="pre">toml++</span></code>. Pure Python libraries are easier to maintain than extension modules.</li> <li><code class="docutils literal notranslate"><span class="pre">rtoml</span></code> is a Python wrapper for the Rust project <code class="docutils literal notranslate"><span class="pre">toml-rs</span></code> and hence has similar shortcomings to <code class="docutils literal notranslate"><span class="pre">pytomlpp</span></code>. In addition, it does not support TOML 1.0.0.</li> <li>Writing an implementation from scratch. It’s unclear what we would get from this; <code class="docutils literal notranslate"><span class="pre">tomli</span></code> meets our needs and the author is willing to help with its inclusion in the standard library.</li> </ul> </section> <section id="including-an-api-for-writing-toml"> <h3><a class="toc-backref" href="#including-an-api-for-writing-toml" role="doc-backlink">Including an API for writing TOML</a></h3> <p>There are several reasons to not include an API for writing TOML.</p> <p>The ability to write TOML is not needed for the use cases that motivate this PEP: core Python packaging tools, and projects that need to read TOML configuration files.</p> <p>Use cases that involve editing an existing TOML file (as opposed to writing a brand new one) are better served by a style preserving library. TOML is intended as a human-readable and -editable configuration format, so it’s important to preserve comments, formatting and other markup. This requires a parser whose output includes style-related metadata, making it impractical to output plain Python types like <code class="docutils literal notranslate"><span class="pre">str</span></code> and <code class="docutils literal notranslate"><span class="pre">dict</span></code>. Furthermore, it substantially complicates the design of the API.</p> <p>Even without considering style preservation, there are too many degrees of freedom in how to design a write API. For example, what default style (indentation, vertical and horizontal spacing, quotes, etc) should the library use for the output, and how much control should users be given over it? How should the library handle input and output validation? Should it support serialization of custom types, and if so, how? While there are reasonable options for resolving these issues, the nature of the standard library is such that we only get “one chance to get it right”.</p> <p>Currently, no CPython core developers have expressed willingness to maintain a write API, or sponsor a PEP that includes one. Since it is hard to change or remove something in the standard library, it is safer to err on the side of exclusion for now, and potentially revisit this later.</p> <p>Therefore, writing TOML is left to third-party libraries. If a good API and relevant use cases for it are found later, write support can be added in a future PEP.</p> </section> <section id="assorted-api-details"> <h3><a class="toc-backref" href="#assorted-api-details" role="doc-backlink">Assorted API details</a></h3> <section id="types-accepted-as-the-first-argument-of-tomllib-load"> <h4><a class="toc-backref" href="#types-accepted-as-the-first-argument-of-tomllib-load" role="doc-backlink">Types accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.load</span></code></a></h4> <p>The <code class="docutils literal notranslate"><span class="pre">toml</span></code> library on PyPI allows passing paths (and lists of path-like objects, ignoring missing files and merging the documents into a single object) to its <code class="docutils literal notranslate"><span class="pre">load</span></code> function. However, allowing this here would be inconsistent with the behavior of <code class="docutils literal notranslate"><span class="pre">json.load</span></code>, <code class="docutils literal notranslate"><span class="pre">pickle.load</span></code> and other standard library functions. If we agree that consistency here is desirable, allowing paths is out of scope for this PEP. This can easily and explicitly be worked around in user code, or by using a third-party library.</p> <p>The proposed API takes a binary file, while <code class="docutils literal notranslate"><span class="pre">toml.load</span></code> takes a text file and <code class="docutils literal notranslate"><span class="pre">json.load</span></code> takes either. Using a binary file allows us to ensure UTF-8 is the encoding used (ensuring correct parsing on platforms with other default encodings, such as Windows), and avoid incorrectly parsing files containing single carriage returns as valid TOML due to universal newlines in text mode.</p> </section> <section id="type-accepted-as-the-first-argument-of-tomllib-loads"> <h4><a class="toc-backref" href="#type-accepted-as-the-first-argument-of-tomllib-loads" role="doc-backlink">Type accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code></a></h4> <p>While <code class="docutils literal notranslate"><span class="pre">tomllib.load</span></code> takes a binary file, <code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code> takes a text string. This may seem inconsistent at first.</p> <p>Quoting the <a class="reference external" href="https://toml.io/en/v1.0.0#spec">TOML v1.0.0 specification</a>:</p> <blockquote> <div>A TOML file must be a valid UTF-8 encoded Unicode document.</div></blockquote> <p><code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code> does not intend to load a TOML file, but rather the document that the file stores. The most natural representation of a Unicode document in Python is <code class="docutils literal notranslate"><span class="pre">str</span></code>, not <code class="docutils literal notranslate"><span class="pre">bytes</span></code>.</p> <p>It is possible to add <code class="docutils literal notranslate"><span class="pre">bytes</span></code> support in the future if needed, but we are not aware of any use cases for it.</p> </section> </section> <section id="controlling-the-type-of-mappings-returned-by-tomllib-load-s"> <h3><a class="toc-backref" href="#controlling-the-type-of-mappings-returned-by-tomllib-load-s" role="doc-backlink">Controlling the type of mappings returned by <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></h3> <p>The <code class="docutils literal notranslate"><span class="pre">toml</span></code> library on PyPI accepts a <code class="docutils literal notranslate"><span class="pre">_dict</span></code> argument in its <code class="docutils literal notranslate"><span class="pre">load[s]</span></code> functions, which works similarly to the <code class="docutils literal notranslate"><span class="pre">object_hook</span></code> argument in <code class="docutils literal notranslate"><span class="pre">json.load[s]</span></code>. There are several uses of <code class="docutils literal notranslate"><span class="pre">_dict</span></code> found on <a class="reference external" href="https://grep.app">https://grep.app</a>; however, almost all of them are passing <code class="docutils literal notranslate"><span class="pre">_dict=OrderedDict</span></code>, which should be unnecessary as of Python 3.7. We found two instances of relevant use: in one case, a custom class was passed for friendlier KeyErrors; in the other, the custom class had several additional lookup and mutation methods (e.g. to help resolve dotted keys).</p> <p>Such a parameter is not necessary for the core use cases outlined in the <a class="reference internal" href="#motivation">Motivation</a> section. The absence of this can be pretty easily worked around using a wrapper class, transformer function, or a third-party library. Finally, support could be added later in a backward-compatible way.</p> </section> <section id="removing-support-for-parse-float-in-tomllib-load-s"> <h3><a class="toc-backref" href="#removing-support-for-parse-float-in-tomllib-load-s" role="doc-backlink">Removing support for <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> in <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></h3> <p>This option is not strictly necessary, since TOML floats should be implemented as “IEEE 754 binary64 values”, which is equivalent to a Python <code class="docutils literal notranslate"><span class="pre">float</span></code> on most architectures.</p> <p>The TOML specification uses the word “SHOULD”, however, implying a recommendation that can be ignored for valid reasons. Parsing floats differently, such as to <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code>, allows users extra precision beyond that promised by the TOML format. In the author of <code class="docutils literal notranslate"><span class="pre">tomli</span></code>’s experience, this is particularly useful in scientific and financial applications. This is also useful for other cases that need greater precision, or where end-users include non-developers who may not be aware of the limits of binary64 floats.</p> <p>There are also niche architectures where the Python <code class="docutils literal notranslate"><span class="pre">float</span></code> is not a IEEE 754 binary64 value. The <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> argument allows users to achieve correct TOML semantics even on such architectures.</p> </section> <section id="alternative-names-for-the-module"> <h3><a class="toc-backref" href="#alternative-names-for-the-module" role="doc-backlink">Alternative names for the module</a></h3> <p>Ideally, we would be able to use the <code class="docutils literal notranslate"><span class="pre">toml</span></code> module name.</p> <p>However, the <code class="docutils literal notranslate"><span class="pre">toml</span></code> package on PyPI is widely used, so there are backward compatibility concerns. Since the standard library takes precedence over third party packages, libraries and applications who current depend on the <code class="docutils literal notranslate"><span class="pre">toml</span></code> package would likely break when upgrading Python versions due to the many API incompatibilities listed in <a class="reference internal" href="#pep-680-appendix-a">Appendix A</a>, even if they pin their dependency versions.</p> <p>To further clarify, applications with pinned dependencies are of greatest concern here. Even if we were able to obtain control of the <code class="docutils literal notranslate"><span class="pre">toml</span></code> PyPI package name and repurpose it for a backport of the proposed new module, we would still break users on new Python versions that included it in the standard library, regardless of whether they have pinned an older version of the existing <code class="docutils literal notranslate"><span class="pre">toml</span></code> package. This is unfortunate, since pinning would likely be a common response to breaking changes introduced by repurposing the <code class="docutils literal notranslate"><span class="pre">toml</span></code> package as a backport (that is incompatible with today’s <code class="docutils literal notranslate"><span class="pre">toml</span></code>).</p> <p>Finally, the <code class="docutils literal notranslate"><span class="pre">toml</span></code> package on PyPI is not actively maintained, but as of yet, efforts to request that the author add other maintainers <a class="reference external" href="https://github.com/uiri/toml/issues/361">have been unsuccessful</a>, so action here would likely have to be taken without the author’s consent.</p> <p>Instead, this PEP proposes the name <code class="docutils literal notranslate"><span class="pre">tomllib</span></code>. This mirrors <code class="docutils literal notranslate"><span class="pre">plistlib</span></code> and <code class="docutils literal notranslate"><span class="pre">xdrlib</span></code>, two other file format modules in the standard library, as well as other modules, such as <code class="docutils literal notranslate"><span class="pre">pathlib</span></code>, <code class="docutils literal notranslate"><span class="pre">contextlib</span></code> and <code class="docutils literal notranslate"><span class="pre">graphlib</span></code>.</p> <p>Other names considered but rejected include:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">tomlparser</span></code>. This mirrors <code class="docutils literal notranslate"><span class="pre">configparser</span></code>, but is perhaps somewhat less appropriate if we include a write API in the future.</li> <li><code class="docutils literal notranslate"><span class="pre">tomli</span></code>. This assumes we use <code class="docutils literal notranslate"><span class="pre">tomli</span></code> as the basis for implementation.</li> <li><code class="docutils literal notranslate"><span class="pre">toml</span></code> under some namespace, such as <code class="docutils literal notranslate"><span class="pre">parser.toml</span></code>. However, this is awkward, especially so since existing parsing libraries like <code class="docutils literal notranslate"><span class="pre">json</span></code>, <code class="docutils literal notranslate"><span class="pre">pickle</span></code>, <code class="docutils literal notranslate"><span class="pre">xml</span></code>, <code class="docutils literal notranslate"><span class="pre">html</span></code> etc. would not be included in the namespace.</li> </ul> </section> </section> <section id="previous-discussion"> <h2><a class="toc-backref" href="#previous-discussion" role="doc-backlink">Previous Discussion</a></h2> <ul class="simple"> <li><a class="reference external" href="https://bugs.python.org/issue40059">bpo-40059: Provide a toml module in the standard library</a></li> <li><a class="reference external" href="https://mail.python.org/pipermail/python-dev/2019-May/157405.html">[Python-Dev] Adding a toml module to the standard lib?</a></li> <li><a class="reference external" href="https://mail.python.org/archives/list/python-ideas@python.org/thread/IWJ3I32A4TY6CIVQ6ONPEBPWP4TOV2V7/">[Python-Ideas] Python standard library TOML module</a></li> <li><a class="reference external" href="https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068">[Packaging] Adopting/recommending a toml parser?</a></li> <li><a class="reference external" href="https://github.com/hukkin/tomli/issues/141">hukkin/tomli#141: Please consider pushing tomli into the stdlib</a></li> </ul> </section> <section id="appendix-a-differences-between-proposed-api-and-toml"> <span id="pep-680-appendix-a"></span><h2><a class="toc-backref" href="#appendix-a-differences-between-proposed-api-and-toml" role="doc-backlink">Appendix A: Differences between proposed API and <code class="docutils literal notranslate"><span class="pre">toml</span></code></a></h2> <p>This appendix covers the differences between the API proposed in this PEP and that of the third-party package <code class="docutils literal notranslate"><span class="pre">toml</span></code>. These differences are relevant to understanding the amount of breakage we could expect if we used the <code class="docutils literal notranslate"><span class="pre">toml</span></code> name for the standard library module, as well as to better understand the design space. Note that this list might not be exhaustive.</p> <ol class="arabic"> <li>No proposed inclusion of a write API (no <code class="docutils literal notranslate"><span class="pre">toml.dump[s]</span></code>)<p>This PEP currently proposes not including a write API; that is, there will be no equivalent of <code class="docutils literal notranslate"><span class="pre">toml.dump</span></code> or <code class="docutils literal notranslate"><span class="pre">toml.dumps</span></code>, as discussed at <a class="reference internal" href="#including-an-api-for-writing-toml">Including an API for writing TOML</a>.</p> <p>If we included a write API, it would be relatively straightforward to convert most code that uses <code class="docutils literal notranslate"><span class="pre">toml</span></code> to the new standard library module (acknowledging that this is very different from a compatible API, as it would still require code changes).</p> <p>A significant fraction of <code class="docutils literal notranslate"><span class="pre">toml</span></code> users rely on this, based on comparing <a class="reference external" href="https://grep.app/search?q=toml.load&filter[lang][0]=Python">occurrences of “toml.load”</a> to <a class="reference external" href="https://grep.app/search?q=toml.dump&filter[lang][0]=Python">occurrences of “toml.dump”</a>.</p> </li> <li>Different first argument of <code class="docutils literal notranslate"><span class="pre">toml.load</span></code><p><code class="docutils literal notranslate"><span class="pre">toml.load</span></code> has the following signature:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">load</span><span class="p">(</span> <span class="n">f</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">SupportsRead</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">PathLike</span> <span class="o">|</span> <span class="nb">str</span> <span class="o">|</span> <span class="nb">bytes</span><span class="p">]],</span> <span class="n">_dict</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="n">MutableMapping</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]]</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> <span class="n">decoder</span><span class="p">:</span> <span class="n">TomlDecoder</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> <span class="p">)</span> <span class="o">-></span> <span class="n">MutableMapping</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]:</span> <span class="o">...</span> </pre></div> </div> <p>This is quite different from the first argument proposed in this PEP: <code class="docutils literal notranslate"><span class="pre">SupportsRead[bytes]</span></code>.</p> <p>Recapping the reasons for this, previously mentioned at <a class="reference internal" href="#types-accepted-as-the-first-argument-of-tomllib-load">Types accepted as the first argument of tomllib.load</a>:</p> <ul class="simple"> <li>Allowing paths (and even lists of paths) as arguments is inconsistent with other similar functions in the standard library.</li> <li>Using <code class="docutils literal notranslate"><span class="pre">SupportsRead[bytes]</span></code> allows us to ensure UTF-8 is the encoding used, and avoid incorrectly parsing single carriage returns as valid TOML.</li> </ul> <p>A significant fraction of <code class="docutils literal notranslate"><span class="pre">toml</span></code> users rely on this, based on manual inspection of <a class="reference external" href="https://grep.app/search?q=toml.load&filter[lang][0]=Python">occurrences of “toml.load”</a>.</p> </li> <li>Errors<p><code class="docutils literal notranslate"><span class="pre">toml</span></code> raises <code class="docutils literal notranslate"><span class="pre">TomlDecodeError</span></code>, vs. the proposed <a class="pep reference internal" href="../pep-0008/" title="PEP 8 – Style Guide for Python Code">PEP 8</a>-compliant <code class="docutils literal notranslate"><span class="pre">TOMLDecodeError</span></code>.</p> <p>A significant fraction of <code class="docutils literal notranslate"><span class="pre">toml</span></code> users rely on this, based on <a class="reference external" href="https://grep.app/search?q=TomlDecodeError&case=true&filter[lang][0]=Python">occurrences of “TomlDecodeError”</a>.</p> </li> <li><code class="docutils literal notranslate"><span class="pre">toml.load[s]</span></code> accepts a <code class="docutils literal notranslate"><span class="pre">_dict</span></code> argument<p>Discussed at <a class="reference internal" href="#controlling-the-type-of-mappings-returned-by-tomllib-load-s">Controlling the type of mappings returned by tomllib.load[s]</a>.</p> <p>As mentioned there, almost all usage consists of <code class="docutils literal notranslate"><span class="pre">_dict=OrderedDict</span></code>, which is not necessary in Python 3.7 and later.</p> </li> <li><code class="docutils literal notranslate"><span class="pre">toml.load[s]</span></code> support an undocumented <code class="docutils literal notranslate"><span class="pre">decoder</span></code> argument<p>It seems the intended use case is for an implementation of comment preservation. The information recorded is not sufficient to roundtrip the TOML document preserving style, the implementation has known bugs, the feature is undocumented and we could only find one instance of its use on <a class="reference external" href="https://grep.app">https://grep.app</a>.</p> <p>The <a class="reference external" href="https://github.com/uiri/toml/blob/3f637dba5f68db63d4b30967fedda51c82459471/toml/decoder.pyi#L36">toml.TomlDecoder interface</a> exposed is far from simple, containing nine methods.</p> <p>Users are likely better served by a more complete implementation of style-preserving parsing and writing.</p> </li> <li><code class="docutils literal notranslate"><span class="pre">toml.dump[s]</span></code> support an <code class="docutils literal notranslate"><span class="pre">encoder</span></code> argument<p>Note that we currently propose to not include a write API; however, if that were to change, these differences would likely become relevant.</p> <p>The <code class="docutils literal notranslate"><span class="pre">encoder</span></code> argument enables two use cases:</p> <ul class="simple"> <li>control over how custom types should be serialized, and</li> <li>control over how output should be formatted.</li> </ul> <p>The first is reasonable; however, we could only find two instances of this on <a class="reference external" href="https://grep.app">https://grep.app</a>. One of these two used this ability to add support for dumping <code class="docutils literal notranslate"><span class="pre">decimal.Decimal</span></code>, which a potential standard library implementation would support out of the box. If needed for other types, this use case could be well served by the equivalent of the <code class="docutils literal notranslate"><span class="pre">default</span></code> argument in <code class="docutils literal notranslate"><span class="pre">json.dump</span></code>.</p> <p>The second use case is enabled by allowing users to specify subclasses of <a class="reference external" href="https://github.com/uiri/toml/blob/3f637dba5f68db63d4b30967fedda51c82459471/toml/encoder.pyi#L9">toml.TomlEncoder</a> and overriding methods to specify parts of the TOML writing process. The API consists of five methods and exposes substantial implementation detail.</p> <p>There is some usage of the <code class="docutils literal notranslate"><span class="pre">encoder</span></code> API on <a class="reference external" href="https://grep.app">https://grep.app</a>; however, it appears to account for a tiny fraction of the overall usage of <code class="docutils literal notranslate"><span class="pre">toml</span></code>.</p> </li> <li>Timezones<p><code class="docutils literal notranslate"><span class="pre">toml</span></code> uses and exposes custom <code class="docutils literal notranslate"><span class="pre">toml.tz.TomlTz</span></code> timezone objects. The proposed implementation uses <code class="docutils literal notranslate"><span class="pre">datetime.timezone</span></code> objects from the standard library.</p> </li> </ol> </section> <section id="copyright"> <h2><a class="toc-backref" href="#copyright" role="doc-backlink">Copyright</a></h2> <p>This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive.</p> </section> </section> <hr class="docutils" /> <p>Source: <a class="reference external" href="https://github.com/python/peps/blob/main/peps/pep-0680.rst">https://github.com/python/peps/blob/main/peps/pep-0680.rst</a></p> <p>Last modified: <a class="reference external" href="https://github.com/python/peps/commits/main/peps/pep-0680.rst">2025-02-01 08:55:40 GMT</a></p> </article> <nav id="pep-sidebar"> <h2>Contents</h2> <ul> <li><a class="reference internal" href="#abstract">Abstract</a></li> <li><a class="reference internal" href="#motivation">Motivation</a></li> <li><a class="reference internal" href="#rationale">Rationale</a></li> <li><a class="reference internal" href="#specification">Specification</a></li> <li><a class="reference internal" href="#maintenance-implications">Maintenance Implications</a><ul> <li><a class="reference internal" href="#stability-of-toml">Stability of TOML</a></li> <li><a class="reference internal" href="#maintainability-of-proposed-implementation">Maintainability of proposed implementation</a></li> <li><a class="reference internal" href="#toml-support-a-slippery-slope-for-other-things">TOML support a slippery slope for other things</a></li> </ul> </li> <li><a class="reference internal" href="#backwards-compatibility">Backwards Compatibility</a></li> <li><a class="reference internal" href="#security-implications">Security Implications</a></li> <li><a class="reference internal" href="#how-to-teach-this">How to Teach This</a></li> <li><a class="reference internal" href="#reference-implementation">Reference Implementation</a></li> <li><a class="reference internal" href="#rejected-ideas">Rejected Ideas</a><ul> <li><a class="reference internal" href="#basing-on-another-toml-implementation">Basing on another TOML implementation</a></li> <li><a class="reference internal" href="#including-an-api-for-writing-toml">Including an API for writing TOML</a></li> <li><a class="reference internal" href="#assorted-api-details">Assorted API details</a><ul> <li><a class="reference internal" href="#types-accepted-as-the-first-argument-of-tomllib-load">Types accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.load</span></code></a></li> <li><a class="reference internal" href="#type-accepted-as-the-first-argument-of-tomllib-loads">Type accepted as the first argument of <code class="docutils literal notranslate"><span class="pre">tomllib.loads</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#controlling-the-type-of-mappings-returned-by-tomllib-load-s">Controlling the type of mappings returned by <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></li> <li><a class="reference internal" href="#removing-support-for-parse-float-in-tomllib-load-s">Removing support for <code class="docutils literal notranslate"><span class="pre">parse_float</span></code> in <code class="docutils literal notranslate"><span class="pre">tomllib.load[s]</span></code></a></li> <li><a class="reference internal" href="#alternative-names-for-the-module">Alternative names for the module</a></li> </ul> </li> <li><a class="reference internal" href="#previous-discussion">Previous Discussion</a></li> <li><a class="reference internal" href="#appendix-a-differences-between-proposed-api-and-toml">Appendix A: Differences between proposed API and <code class="docutils literal notranslate"><span class="pre">toml</span></code></a></li> <li><a class="reference internal" href="#copyright">Copyright</a></li> </ul> <br> <a id="source" href="https://github.com/python/peps/blob/main/peps/pep-0680.rst">Page Source (GitHub)</a> </nav> </section> <script src="../_static/colour_scheme.js"></script> <script src="../_static/wrap_tables.js"></script> <script src="../_static/sticky_banner.js"></script> </body> </html>