A python wrapper for toml++
Project description
pytomlpp
This is an unofficial python wrapper for tomlplusplus (https://marzer.github.io/tomlplusplus/).
Some points you may want to know before use:
- Using
tomlplusplus
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.
Example
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 exisitng python TOML parser on the market but from my experience they are all purely implemented in python which is a bit slow.
In [1]: import pytomlpp
In [2]: import toml
In [3]: def run_parser(parser_func, toml_string):
...: for i in range(1000):
...: parser_func(toml_string)
...:
In [4]: %timeit run_parser(pytomlpp.loads, toml_string)
310 ms ± 56.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
In [5]: %timeit run_parser(toml.loads, toml_string)
3.5 s ± 162 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
In [6]: pytomlpp.lib_version
Out[6]: '1.3.2'
Installing
We recommand you to use pip
to install this package:
pip install pytomlpp
You can also use conda
to install this package, Note we only support linux 64 python 3.8 for now, I would love to provide this package on more python versions and platforms via conda but I have not found a way yet to automate this in the CI, if you know how to do this please contribute!
conda install -c dorafmon pytomlpp
You can also install from source:
git clone git@github.com:bobfang1992/pytomlpp.git
cd pytomlpp
pip install .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pytomlpp-0.2.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 197b325e3036bdd656e149afc3cb4f193a34f483fdfaa8a01184e9333f90bd6a |
|
MD5 | 278b502a1a4e5ef8b740609abde2ba08 |
|
BLAKE2b-256 | 163f8b5ff947b187480bd237104e636c1bff63dae778a4e39c8ae1cbcb616849 |
Hashes for pytomlpp-0.2.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17c8667eb73ab2c037361c39db439fdb518105623dc066e842fe3995550de096 |
|
MD5 | ab6240fe308f8cfd99220516488795c5 |
|
BLAKE2b-256 | 9eb9f926c2f4adc20c751b90d84ec0b7bb34dd8063259df6b3ae3af24abb7881 |
Hashes for pytomlpp-0.2.2-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef8eea2fea8e8d54d1d5fc79066702a1f2923d0c03ba3db6c6aca902de5a0f56 |
|
MD5 | 921b93e83f8bad9b26f37a90f5cddd3f |
|
BLAKE2b-256 | c0e337a2ad57df37b6d97313d3a69fadb7d878e5095755978ba37964dc25205e |
Hashes for pytomlpp-0.2.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53a828a2d70b4e0094a45fa6dd55e8d608981959591755e16b2d3ba409c1023d |
|
MD5 | a5eadac4c9a4edefe152610ceded8c6d |
|
BLAKE2b-256 | a2de5b3632c4e492764f65e00206aa94e552ab227d66a248dc8c01b179448592 |
Hashes for pytomlpp-0.2.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dede0f34323b52ba064919da980519255729e5a5ebf670c31082070f284b8a2e |
|
MD5 | 49f62eb9d9ddde69030b2e582a3b7b8b |
|
BLAKE2b-256 | 7b1982e6ab4095c2e813de52593bf535a35cfad6ad0e4e77b09053d08ce5f0b9 |
Hashes for pytomlpp-0.2.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b77e83f313a8e2163aeb96af5a73b0a1999e2ec19ceea8f5e3f57fb0199d8aa8 |
|
MD5 | ca2851594005b485c1c058e95f99e482 |
|
BLAKE2b-256 | fe272fe882051d06c9c7b8e35f1c2217b2e9f54c29d26ac11a0500aae412be34 |
Hashes for pytomlpp-0.2.2-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a301178a27ff5958d7f27d743205628aa0c846ebbfff90aad3827dd89e110fb |
|
MD5 | cca547dd4c31937732ae829eeb9c4b9f |
|
BLAKE2b-256 | 35aa20e7ed7cc79a20a3d081a449564b92b22a7cbe2c29f8d7f0bb3d8581a7d1 |
Hashes for pytomlpp-0.2.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 261deb6395fbc0454a70954bd11d95eaa0a262d628611d40ad523ec8a1ec2d64 |
|
MD5 | 97ba44e9d5713b697101f125c8d419c7 |
|
BLAKE2b-256 | 75bbcf9cbc699329df02f2a1515c4f0f78f18e4004d453e0d5e4076d56c23c48 |
Hashes for pytomlpp-0.2.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | effe9a44a2c7ef6242eee4b441863cdc40fbbf0afcc967b10bb6023497ef645e |
|
MD5 | 917959120d663a9cb2f86772012e8451 |
|
BLAKE2b-256 | daa821a5e0f56ae3331204ab882245633119081a4a13cd791a31487080bcc8f5 |
Hashes for pytomlpp-0.2.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3bb26dc0adb1b83a79884712c875f9fdda6d9fb3aaff459322666016f146e2e |
|
MD5 | 5ece11a656795c48e377f335395906ee |
|
BLAKE2b-256 | 2aa2b0902295309d9d533f047b274289063ead6c65374b51bfae8591c1c36026 |
Hashes for pytomlpp-0.2.2-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcd848f9c2485848795bbd944336bfddb013195f414c19baf3333db8d68ee477 |
|
MD5 | e96041c94ae984541d919b27d77d95fc |
|
BLAKE2b-256 | ebdbbf352bc924178034a050c2fa1560f33fd13f20176badb1876e894bf9c298 |
Hashes for pytomlpp-0.2.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11180663e4f39d7ea34a4298872946d026b66c66f33562baf4c5794367cd223 |
|
MD5 | 25c8dc3e53d5ffff69bebca385fa1c25 |
|
BLAKE2b-256 | f2e0179680c97787d5cb63213569154ebe6c545256c290ef5863a828508e351d |
Hashes for pytomlpp-0.2.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2347d0c348315f8a4a970005c45016788d46beba1243afa85ff5be7cd67ee72f |
|
MD5 | 8d7a108c7310c63b43bec19db293d5e3 |
|
BLAKE2b-256 | 32219b716f79a82ed2453b6042b48f4331abd31134a052947ef78119ed2774ea |
Hashes for pytomlpp-0.2.2-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 537f8fc8a4ab8c7dcf357011c92a8dcbc7aa99bfa47b6b37ab2b37cf7df6b5e8 |
|
MD5 | bac2733040c375ab4eadbb64501f1fe1 |
|
BLAKE2b-256 | f306e6fc72a0f7c17638dc764842828fabc0359c1b07fdc23846f1ec9ac2e1bf |
Hashes for pytomlpp-0.2.2-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c06675d65b4fa8aac5bc48fcd943ca091ed4cf1b53eed41f92eea9310f59f868 |
|
MD5 | 92f5d6c1ffcaef667b84910edf8f0eac |
|
BLAKE2b-256 | ec820d8dac8873ab7e4e5f2beb826c686e1d723619d0f3539d1ec37195afe885 |
Hashes for pytomlpp-0.2.2-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee7374b996d424712b96f0775632895bd984963b0a720e209b4c403ff006765 |
|
MD5 | 672de100196c6f52627446f26216ff15 |
|
BLAKE2b-256 | f5cdc2f444fe5e1f97d9683f0fea97716e34e08fff1c274e749eedc4ee5e90db |