A python wrapper for toml++
Project description
pytomlpp
This is an 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. - 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 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 5000 times:
pytomlpp: 0.662 s
toml: 5.277 s (7.9x slower)
qtoml: 8.020 s (12.1x slower)
tomlkit: 32.898 s (49.6x slower)
Test it for yourself using the benchmark script.
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-1.0.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32e6a349602e1171e070afb1b4b022eccae90649e500bef722093ee96af21f7a |
|
MD5 | df603680ec00e1c65be00cfe482f18b8 |
|
BLAKE2b-256 | 89b3f387bea13e9458e4cfe853ed3c67d9abcf90cad7ad97e861c6216f5aafc0 |
Hashes for pytomlpp-1.0.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22e718aec3ff0c22e1cf9fc4e0e20bfdabe1fc2ba4c7f88899371c3286dc640f |
|
MD5 | 7799e6e61f98ed59c626fe5f22663756 |
|
BLAKE2b-256 | 899bf8537531f31c40384ca76381d92646ed4dd8fb608bf494bdf3edfda9078f |
Hashes for pytomlpp-1.0.1-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d9427ab7479e5b03171234493013a35ce1132c91b4383d06e299e4a4dd0d3e5 |
|
MD5 | 746fc1023481cfa2d738b0f2540c45a9 |
|
BLAKE2b-256 | 501a8b3160bb37053b8798b254a985e67aa0555c375a6497cfe3590be87e03d7 |
Hashes for pytomlpp-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26bc34cec8acd3a65655dc31308aa9e8f89262432dc04711410035618657964b |
|
MD5 | 4d83087cd9fe671167ec181639f8c19a |
|
BLAKE2b-256 | edc3d07cec0c9a25c525340eddc42d2b1dc6dfe46b81ddcffb7fe5d5f1539608 |
Hashes for pytomlpp-1.0.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07a5460abc4292abdc945c6e2304747b427dfefcc75d9ecab16af7457a0ca728 |
|
MD5 | 5d130bb9acba0bb227d03933357ef440 |
|
BLAKE2b-256 | 7021da7af596bf182d707a635aa26477af46e64f7b319345fe3361a51f1e85bb |
Hashes for pytomlpp-1.0.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb09f7575720e183d911c047df5b9cd60679d2af08853a29f6b9437e8f0e2b9d |
|
MD5 | d0bad00029557f55eb3e5d185f5c1a0a |
|
BLAKE2b-256 | c3e5d3ffc7b393916d6e872e280a04f847df1b9922f9ca2d4071f671c24784ac |
Hashes for pytomlpp-1.0.1-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26677a8e64be8570ecc5833995c1f0518332c179d35489e2293bb88c3993ab87 |
|
MD5 | e1d8dd227c3ca286948167918cc25bc8 |
|
BLAKE2b-256 | 68229235b0fb76e5d000b5f7bc27be7143b37671cd807f131c8e6caee8f29ce3 |
Hashes for pytomlpp-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969387fa00f2593d05f7d098ec135cd64e147b39db8a63e960022d136a0c8319 |
|
MD5 | e07efff6205efa8d06077cad8bdde0e3 |
|
BLAKE2b-256 | 0e9bcb506896d468d04ecac84fd8f1ab034077e5ad1966a3f7378e82d8359548 |
Hashes for pytomlpp-1.0.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfa1d0ec9458bd1f865e50d1a3fa6b43896bb7c414d20abf6032e9c1f8926d59 |
|
MD5 | cbed3a9a5b7026317c4c2aee9dc3149f |
|
BLAKE2b-256 | a17722486c24f7f87caad32a5ac92cc483d2e91ab9301012b837ebf26810c02e |
Hashes for pytomlpp-1.0.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fb2e2414b27179eafcfa9a775779988ba965579cc66bdc0f05bac5eafd4b165 |
|
MD5 | d0a7ac1579973ad069c61daa5235ad8b |
|
BLAKE2b-256 | d1d15a6099fdbde134b4b0c783afd2b2d52d30520c53343370e25d6cb21d2623 |
Hashes for pytomlpp-1.0.1-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c986921479f334d96edfe2a6ae19a489df090b0f69fb76e525f776d0ebfee891 |
|
MD5 | 4332b1f27cdf346ac5cca68007b3f3a6 |
|
BLAKE2b-256 | 087ada4850b781a2b6b1868703d9c94b9333c242450db38635d3ac3e4d3f6291 |
Hashes for pytomlpp-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c42ea5562d08ff64cb8326eeb0c00cc4d61a63e4a2dd3e39830afb93e48b5479 |
|
MD5 | 57f477ee697f660cf2c815144065ccba |
|
BLAKE2b-256 | 4813c510f0fd28fa927fa14e4a6e009595913cf531027fe91b28df712aecbc94 |
Hashes for pytomlpp-1.0.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3443830bbd65e96a468d940b68724ccb7e8fb18f6e66a4f4e075bc17e7ac0596 |
|
MD5 | 85c579796b73e1e838a27ead019f1265 |
|
BLAKE2b-256 | 5df95625702de236471fa487e40955f97d1f0e46be6d5e02b1efd743a2abadd5 |
Hashes for pytomlpp-1.0.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a863ca428ec997dc263e4a3c8ba2466f9e9ac46f996aee642d7686e5faee3e9 |
|
MD5 | c32f59fd0f46116ea66f172702363b4a |
|
BLAKE2b-256 | 4e769eaff694bfc2092a9c6acc50fe3e9e9b20c8d0e29dd550d8cb3dd524a655 |
Hashes for pytomlpp-1.0.1-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 350b01a7396d19c7c5b52d43c6e750d246f681994c63273fea2899d6c6c81ff5 |
|
MD5 | c785be84b91eb2033121a3d3de174f7a |
|
BLAKE2b-256 | 722e551a568f869fb4904eb7b3de18381076d98a49e987087024ddb33a15efd1 |
Hashes for pytomlpp-1.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94edd918460192d51e46cbbaa96986da0ea5067d7211a93ad7305473b23240a9 |
|
MD5 | 562c91d7accb78aa83afc723721d3722 |
|
BLAKE2b-256 | e13023a892cbfeaa4cebb9529dac0d6d7b3d5700fad3e3ddae7e677fb8b9f8f4 |