A python wrapper for toml++
Project description
pytomlpp
You can try this parser online here.
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 --recurse-submodules=third_party/tomlplusplus --shallow-submodules
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.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfe3997aa14e69036f625e5c57f2da294025b3fa95cfbaac619c8984e718914a |
|
MD5 | cf6081445fbde531ef7972aa07c8e3d7 |
|
BLAKE2b-256 | 0aed153b477131b7615d656e3dfeeedcbece6a9a1358f2b0c0096db5659d39dd |
Hashes for pytomlpp-0.2.9-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b692ec1924ef5006039dd0434e5b2014b8f39120bbd3344851827f7467dfcfff |
|
MD5 | 1504f66b2fb64e6b4ae06fee6149232c |
|
BLAKE2b-256 | d0a15647f755d4308be050fe0543f66c312320621b62cea5ae33921206277e5c |
Hashes for pytomlpp-0.2.9-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffc8cd79e7bb389d5413b65a2057d1b9cfa590e39590bcaacdad8cec679d7104 |
|
MD5 | 8007bc8cd528a8c3945422f3c3ea49db |
|
BLAKE2b-256 | 243427ddd20f21493a31b50291f89fe8e79ff47038a02c94bcdcd8b4857b7090 |
Hashes for pytomlpp-0.2.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23db085328683007a778a1618c79f118028f798f48147469e8ca8713382c3fba |
|
MD5 | fc253244555f7f2d3d1657c2ec08a2ec |
|
BLAKE2b-256 | 89a377c7f23835950b2e43c91d1f8c44197faec7f97a1d82131aa97bed8f6074 |
Hashes for pytomlpp-0.2.9-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df61b5cd82dab3c4878e398fbd4ebf0828627e475fbd851691a721b9a7215033 |
|
MD5 | f5e0afe8f9cc97618fa5eeb550f340a2 |
|
BLAKE2b-256 | aec86622c7d85416eef54d240d13615f8c5d68c554c3508bd1e4cbfd86da2179 |
Hashes for pytomlpp-0.2.9-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e05077f8e59597a6f7a8883bc92a15c897885d6aefac7f865b09dbdbff75e265 |
|
MD5 | b972a06c48e65d018c3b767390aacf6b |
|
BLAKE2b-256 | b1f014345f2216962e78d6032f5683fa48ad9ce1e0a2153715a5df3b37d4478b |
Hashes for pytomlpp-0.2.9-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57a91b0bfade3d1db5778dfe0dba20af41413983aad87228d1c1ce42f11a6d58 |
|
MD5 | 66dea38369f1f3592c267cde49a94887 |
|
BLAKE2b-256 | 77dd2dbe0cef6bc749123025ae73f14bd53bd45ca9579737186d8068912456c4 |
Hashes for pytomlpp-0.2.9-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d306b339b8c38f87964c4156de5b9ad57980614b91cb9a522439034573562022 |
|
MD5 | 761f8e49eebe7f8d1c494adaafbd4512 |
|
BLAKE2b-256 | f5343d7684041416d4d1ced419abacdd8e77d2b2ff4d665359eac341000341be |
Hashes for pytomlpp-0.2.9-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f6fcb70ac25332359c9b67fad7733de661b186fac97effce37828aab6009584 |
|
MD5 | 9d71154babc26afa6d6bd29214312bfc |
|
BLAKE2b-256 | 5c1f51b361c6b0c629d747fa25be57cc8cd372c9f9c94b763b7737090b02d325 |
Hashes for pytomlpp-0.2.9-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc57130f2625c1f63eb91457b815c1f3d7f198294f5d1a1f8f244ce1feb07fe |
|
MD5 | 076a22c0d3d9952b0c4306fccf19a017 |
|
BLAKE2b-256 | eb6b1c0e0588f43361c797095324cb4727875cf50af121ffeb50aa67912f299b |
Hashes for pytomlpp-0.2.9-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8a7ba77283c841a8ab25b18649e45ab8cc9d724beab196134ab875a33f67c87 |
|
MD5 | 2e314109fe142cd18e85d7eee17df188 |
|
BLAKE2b-256 | b8848a5ac38c447e35ecaea0e599ce84bcd9e3872162dcdc90b19e8d460e8717 |
Hashes for pytomlpp-0.2.9-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f30c7fec3d645379db0c2b7ad69a0ea2101ebf8cd3cbb800d111b3795c5383a9 |
|
MD5 | be2ad448548a4f75659d0aa8fa600833 |
|
BLAKE2b-256 | 8849d617e5c996bd0ad0dff9f5ed3b415ec91c8f42894e7119b3bc20210f0792 |
Hashes for pytomlpp-0.2.9-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ec26e4ea97085d78662c143239e91a1dbbc5b333172012553b7f9ba6080a63 |
|
MD5 | 76162a46273b6be6798de8a4e3b67d0d |
|
BLAKE2b-256 | 2ff3ce40d836e88e32b80f2cfd9eec6942c43c274ea7f5845d7cd8dd654cbb4f |
Hashes for pytomlpp-0.2.9-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75d7a0d9328e608bbb88ee7794087cf07c40dd217181fd203f1619402a957b86 |
|
MD5 | 7c9611c9d4e159bf60208c96f0712d0a |
|
BLAKE2b-256 | 490b941541adfadd94005894f160d6c6735321e62248df8821dec805e1531ec1 |
Hashes for pytomlpp-0.2.9-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d435b1b1036bdf785cc533d52951d43fe808a39f802551158f020ee14eaa371 |
|
MD5 | 697007d25c30043a5f9dd955f8aec2c5 |
|
BLAKE2b-256 | f25cb94167ed90946680b711e291a59c0686ff956f5460d6830e1ea2862b8764 |
Hashes for pytomlpp-0.2.9-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31f562d75c02d133e643a2cae0b6cd1a108fc3184558b5af2ac534c6ecefe843 |
|
MD5 | b83638532a3f29ad7843f0d077bed7ad |
|
BLAKE2b-256 | f3ac1c95e47a6fab077062cc47301514e0d167ef3df46a637aa22af1358fd00a |