A python wrapper for toml++
Project description
pytomlpp
You can try this parser online here.
This is an unofficial python wrapper for toml++
(https://marzer.github.io/tomlplusplus/).
Some points you may want to know before use:
- Using
toml++
means that this module is fully compatible with TOML v1.0.0-rc.3. - 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.3.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5226444a1c07bc6e58d8654a137eb84a689c87846ff3e906ab9a2c4d0bce6098 |
|
MD5 | 3887c9e14b9b3bbdb23b159479c2dafc |
|
BLAKE2b-256 | 4417d65197e1a59ad3e3b812bcaee7bcfa049f880937df4f58581bf7a6fe9abb |
Hashes for pytomlpp-0.3.5-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b0cac61fd06f2c80281532d41518929b2efe9c7351c145f4960f17a49e55103 |
|
MD5 | 4322c521d037074e194be07a25501977 |
|
BLAKE2b-256 | 4c05d07a3f9075a36111776cd4987353f2995d0680c8ff8b2ee6338585238b30 |
Hashes for pytomlpp-0.3.5-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e87b7342033a9665f7637e146390ef7c6047a958724d7ddf7b3e41fa0e27e5 |
|
MD5 | 468794e6c05df65b4b2c49ef71efdee9 |
|
BLAKE2b-256 | dfd3bd7490310388e291065e36b1a904c5c8bf95a53098622a87eb3aa180639d |
Hashes for pytomlpp-0.3.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d067e96420b494149b8fe2bdc732109e75165e6dbd94f81f998f9eede9003b44 |
|
MD5 | aee88e1ce43cd770106f77cb8dffc245 |
|
BLAKE2b-256 | 7cf44f08451896980864f6667d619af14dae17b956b3a584401332d4cced8a8b |
Hashes for pytomlpp-0.3.5-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68796c50f42949d649f54d8622bd67cc22d4471600a99d702d165f672a80974e |
|
MD5 | ac4a53af333b280bafc1469699d2582f |
|
BLAKE2b-256 | acffb359d5bff13534ab2c03fdbc25cb1b00af3a58715ebed90b4ed91189e90e |
Hashes for pytomlpp-0.3.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cde5dfc2530a15c67ed19145acccc64885e2b530fa9321a31600c29a34462bf0 |
|
MD5 | e3dae3b259d7642f1eb74e053431abb2 |
|
BLAKE2b-256 | 94cb66707e6fe372239c4491763e7cc31dfaf6a7a1c5e600d8ec43ccb339905d |
Hashes for pytomlpp-0.3.5-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6e10b85b9766c69449e67d95a39174fc788d1403d25e7e66726ef13b1817c5f |
|
MD5 | 6f91814647b1f000a0c6968b97260f30 |
|
BLAKE2b-256 | bd640a2394da3b3b80fb4c69dfed09bdea48c9d1997ad59d8d425e3574743469 |
Hashes for pytomlpp-0.3.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f08fc424bc1370aed8deef237746b384a6df138ced4218cee699dcfa25933234 |
|
MD5 | 4ad5259b3a829e523f5728c1b6c32031 |
|
BLAKE2b-256 | 3e09ce01fdcdb67f8b3d93ca30d28dba859ff67398b882c73aa88d8f70c3019a |
Hashes for pytomlpp-0.3.5-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 382073f0aea9c78c79f045ebe171f0a7e6da8d9f7fc3037e9a7b5e995a2e0d54 |
|
MD5 | eb742f57797b909cf7dae3aa1e643a10 |
|
BLAKE2b-256 | 97353bda0703a0d2628ee04b20751d8e1ed167ce349386504a041b8a89925184 |
Hashes for pytomlpp-0.3.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04a45b6c1012f6bd349222b7c80e2ca96670ed280f4a4c04dd98a55efdb70599 |
|
MD5 | ab312122142d91405bb2c2bff62c2325 |
|
BLAKE2b-256 | 520ae44bc391c0ef4ec085ac432b09c3127cb7b05fb6439cdcfcdc18b6837562 |
Hashes for pytomlpp-0.3.5-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ba13631b5085846406affa9d81fe261bd37e03d0afc70b74fddfea9835a846 |
|
MD5 | 0449fddeb58e6c587f246eab7830f839 |
|
BLAKE2b-256 | 85d3db4505a6a7c84fc253a23fe21db3a35a2fb1ffdfc87395775315ab6eea3a |
Hashes for pytomlpp-0.3.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed8545d1ea1d32c28c109b124fa4205a9fb06c800a609a7216767ffe27fb853 |
|
MD5 | 7225501b8a2809f5ead96ea243798812 |
|
BLAKE2b-256 | 768bc8a1cc5f33563a9869c07f3ad654f822de0e2611e136375c747386da8e0a |
Hashes for pytomlpp-0.3.5-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7397d9be88a2ae7d5ae6a72a76cdd76896b45790d4f462f0e11ee4843aaa4a11 |
|
MD5 | 8316c5605d3cb7e4277eb4aad4fd7d22 |
|
BLAKE2b-256 | adf917f8fdd00808a8423e281b2514e63128796ea5f3272ca09a3b50ec12b13f |
Hashes for pytomlpp-0.3.5-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ea9a44b86fbeba981ee0f1576a1f7a22e0e6d701ddeb1c2d86f4a9e170493d |
|
MD5 | eaa73c73094a206a62ff8936a51d077c |
|
BLAKE2b-256 | f00bb107b5fad16c07eca9590c2913bfb8ec9045470759dbd42029993fcedd34 |
Hashes for pytomlpp-0.3.5-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c71e327074f0f76ed96ecb846dbf8195f5033fe95cf0d2ae40c7c4bf0d1106c7 |
|
MD5 | ea74607a24206d1fb9ccfa92c18fea10 |
|
BLAKE2b-256 | 544f4248c7c69fd9d6764f9934843553d61fb8625938080ee7cb20c6182afb6e |
Hashes for pytomlpp-0.3.5-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bae043b8a874e218f904208febab9a285adb13c2d2f8d4ee9fcd4696cf2ad9de |
|
MD5 | 044d11d4c39fe0c83e4f7fd6dd3a1a96 |
|
BLAKE2b-256 | 204675c794597e4421585285ce7b4e0688e029cf25b6675ed99d5eb4c9722ccd |
Hashes for pytomlpp-0.3.5-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9db6eb225004cbcabbef7b90ee2cd3d121d73263c16b328462fba03ddfe29a71 |
|
MD5 | 5b45b7d2aeac61745a25a5c7cd75cffe |
|
BLAKE2b-256 | 04757941c2bb5af715d751772ff646f53defa63f24d8f484902aa8d06f56d34a |
Hashes for pytomlpp-0.3.5-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dcfbc123b02ddd7f3cf9c1045379ff02d96a800e70b91ee2ef38f3450c91ccb |
|
MD5 | bcb57aeff7517204c2558361498309d8 |
|
BLAKE2b-256 | ff7b0436ae471000f7970ef750989d957b4fd61dc885585be562f305a4034c7b |
Hashes for pytomlpp-0.3.5-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a6bb0c53de8beae43fb0e4ca291edbc31e2d4d21a0505354df5a9f27f692914 |
|
MD5 | 4740f40398df3351a7c55f620abb8676 |
|
BLAKE2b-256 | ef201f1506a14cbb7e148e85e21400c987b36bec13258dc2ab2ef1204c3b273f |
Hashes for pytomlpp-0.3.5-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d10884b13222b2f4da19c43bfd3dbd051b4699e3ab283b68a43afbed90cc585d |
|
MD5 | cc39f12707d849dbbf2a934b79d046e3 |
|
BLAKE2b-256 | 985a3c8a247231075e7d6bb26da716cfd7c32c15bc30802d95268487474d05a2 |