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 --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.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc2b9d6dfde59304759bf827c8593d84eab0544bc9a0909a9b444e7f16c081a9 |
|
MD5 | 015d5400b5168edb26fcb1cf32df53f3 |
|
BLAKE2b-256 | d07f68720a0fedd600b340f6cc98ddef2c9f8fdd96bcc7a95c7dda8aaa78b41f |
Hashes for pytomlpp-0.2.6-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 406cba8fe7072ee2d66f245b596ab9bb175aa59ccb6575822ae392f00b6e2384 |
|
MD5 | e72f085320432f35964b4ee418cb4c56 |
|
BLAKE2b-256 | cd935afa45e22cdf4c161dc9d50d3fd1b1218765f72937fc0ffce791e35107d4 |
Hashes for pytomlpp-0.2.6-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0af59393453b9048728b5123eaefb71dcff2af19709a9342ccbb9d591072dc3 |
|
MD5 | dca489f9bd58cdfac680f5247fce93dd |
|
BLAKE2b-256 | 3cf75d2917065521d0b5a90c1d3d83f9fb0d828120710990667bd4ef01293463 |
Hashes for pytomlpp-0.2.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a4fac56c30b366b018588bcd212714fe10530b3b17940d25ab0dd6a62714fa6 |
|
MD5 | 9a9b4f88e39315b067ab8dae00a5a2eb |
|
BLAKE2b-256 | 5cded8eec6276c8edeecb904e2e7e67d460fcbd94546fe8b6822b8b637cb5d82 |
Hashes for pytomlpp-0.2.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 252312e24403691f138565514c46db577fc559167541a17e648e7b292179545f |
|
MD5 | ae516bb710303b17251dd5452b36de66 |
|
BLAKE2b-256 | bc202c6cff1b7acfb405b8a2517a5f10699eef48e6b1a8cec881a50b49bb18a2 |
Hashes for pytomlpp-0.2.6-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67b824f10c0875bd84665ef80211c9fbf3314ba84cd446db554cfb8a56723775 |
|
MD5 | 5571dda49d7e86c11ae5c0725cbea1ae |
|
BLAKE2b-256 | 3fe28036980c422fe1f99e2dc68e9f2be40715a30f5b9fc4ba299959ff3ead16 |
Hashes for pytomlpp-0.2.6-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5a730b21edc0b7749fb6d9a6d4ddf4dc2edb30f3c265ba58858f2bc7f5ca55e |
|
MD5 | 8409039816a537e89366f4b4e264b84f |
|
BLAKE2b-256 | f8107731e00cf0d3c1be56597dbd9fb7e43b3533765fbfeb162d4a8c9137223d |
Hashes for pytomlpp-0.2.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26870a255dda833cc40886f30bab61602a4d95c0403ada648ace04583f352fa4 |
|
MD5 | f770b3c02e83bac76c2285a65a4cfebd |
|
BLAKE2b-256 | dd646586cbbd341138a56691adc6bb2ab9daaed76b3de6e7d3883c9c5e7494b4 |
Hashes for pytomlpp-0.2.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38473a90bd2b927d6f77cd656211fd67616f560368f5fc87fa812072b3cdd4cb |
|
MD5 | 106cef2c85cd7e8ed7a7869adc7a23f3 |
|
BLAKE2b-256 | 1b870578e9410092db846af0641520a75aa61a90cead262ff53e6315e803c779 |
Hashes for pytomlpp-0.2.6-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63237a248484871e753163881710530a02369532d311bd57fd9fd1990f9f373a |
|
MD5 | 319ea87b83345591e2057aef409579a6 |
|
BLAKE2b-256 | fcbb43b0ec2531112920e1f6de16f8f26413fcd2a282c53a549e048c3f15e413 |
Hashes for pytomlpp-0.2.6-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 233ac9d80fb1010653d292a42df2338d36f9c86a6083d92ec06742638d17256d |
|
MD5 | 4e9a9eb121139170e1d5bd6e93616397 |
|
BLAKE2b-256 | e2f0b74896eb3e2a81decb5ed8c5719bfea0fde9e7a704060d298d99a59ed7ba |
Hashes for pytomlpp-0.2.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 932180449cc5d2d4d2b54d4b6160b0916fba30653b188cfea479c266eac21e2d |
|
MD5 | f87307e525d5e4a7ca0a742a64d6ed38 |
|
BLAKE2b-256 | ff68fc579f5e1183c577361b2a749cc0e7b42712543999058e7ea1944f8b43ec |
Hashes for pytomlpp-0.2.6-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f184e2ed3cb8082e494d0361eb91cb5cc455469790c5fa93edd840872a9825f |
|
MD5 | 99e700fdf43a81e81a772b472f3be219 |
|
BLAKE2b-256 | a1fca35d341b03b76e444cc81d13c83a3d83e1f7ac5dc1da473858867a982e47 |
Hashes for pytomlpp-0.2.6-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de740d7a8cac29583af73829e1b3d2a52f24d128796d70845c056249fd620900 |
|
MD5 | a4c3fc175bb1f75fa0e67cb456247cc4 |
|
BLAKE2b-256 | b1917eef481a22108cb6672f25a617f1a2876deac3616503508b7688e5953ce4 |
Hashes for pytomlpp-0.2.6-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9217b247049d03f319253606f9de0460c297f27fe2f9d99e54f4a3862a1c96 |
|
MD5 | 8074014aa2a9142ac9e663307bd0ef9b |
|
BLAKE2b-256 | 11813b466f93b3c4399401be36d9b8ad87520825831acfd22f019a902ce2df13 |
Hashes for pytomlpp-0.2.6-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe387adf8b25428084ce79ec0856169d501ec1ff9afa43d8d265258b9cd1d517 |
|
MD5 | d2469c19fcb0eb911dbc1573eb4928ac |
|
BLAKE2b-256 | fdc47f648ec08009aaf05e3373fb9dade2e7f83182bbf28df23e36ed037424d3 |