Skip to main content

A python wrapper for toml++

Project description


Build Status Conda Status PyPI version

This is an python wrapper for toml++ (

Some points you may want to know before use:

  • Using toml++ means that this module is fully compatible with TOML v1.0.0.
  • We convert toml structure to native python data structures (dict/list etc.) when parsing, this is more inline with what json module does.
  • The binding is using pybind11.
  • The project is tested using toml-test and pytest.
  • We support all major platforms (Linux, Mac OSX and Windows), for both CPython and Pypy and all recent Python versions. You just need to pip install and we have a pre-compiled binaries ready. No need to play with clang, cmake or any C++ toolchains.


In [1]: import pytomlpp                                                                                                                                                                                                                                                                            

In [2]: toml_string = 'hello = "世界"'                                                                                                                                                                                                                                                             

In [3]: pytomlpp.loads(toml_string)                                                                                                                                                                                                                                                                
Out[3]: {'hello': '世界'}

In [4]: type(_)                                                                                                                                                                                                                                                                                    
Out[4]: dict

In [6]: pytomlpp.dumps({"你好": "world"})                                                                                                                 
Out[6]: '"你好" = "world"'

Why bother?

There are some existing python TOML parsers on the market but from my experience they are implemented purely in python which is a bit slow.

Parsing data.toml 1000 times:
  pytomlpp:   0.914 s
     rtoml:   1.148 s ( 1.25x)
     tomli:   4.850 s ( 5.30x)
     qtoml:  11.882 s (12.99x)
   tomlkit:  72.140 s (78.89x)
      toml: Parsing failed. Likely not TOML 1.0.0-compliant.

Test it for yourself using the benchmark script.


We recommend you to use pip to install this package:

pip install pytomlpp

You can also use conda to install this package, on all common platforms & python versions. If you have an issue with a package from conda-forge, you can raise an issue on the feedstock

conda install -c conda-forge pytomlpp

You can also install from source:

git clone --recurse-submodules=third_party/tomlplusplus --shallow-submodules
cd pytomlpp
pip install .


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytomlpp-1.0.13.tar.gz (1.3 MB view hashes)

Uploaded source

Built Distributions

pytomlpp-1.0.13-cp311-cp311-win_amd64.whl (183.7 kB view hashes)

Uploaded cp311

pytomlpp-1.0.13-cp310-cp310-win_amd64.whl (183.7 kB view hashes)

Uploaded cp310

pytomlpp-1.0.13-cp39-cp39-win_amd64.whl (183.8 kB view hashes)

Uploaded cp39

pytomlpp-1.0.13-cp38-cp38-win_amd64.whl (183.6 kB view hashes)

Uploaded cp38

pytomlpp-1.0.13-cp37-cp37m-win_amd64.whl (185.0 kB view hashes)

Uploaded cp37

pytomlpp-1.0.13-cp36-cp36m-win_amd64.whl (192.6 kB view hashes)

Uploaded cp36

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page