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.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1731ea6b00736ede7d2ce87c91ffb887b7a09f7970b8ec964be882ff151c6d9a |
|
MD5 | fdc0aae311a7ad35503b9322009c554b |
|
BLAKE2b-256 | bc52c4925b1b55219fbcfd479102ea07e33cefc13e20f6f78b0997476b25c2b1 |
Hashes for pytomlpp-0.3.4-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c85edc81343122a65c7ec31f51d293033023035d8b3f6f61bfa1b1a5c0fcd7c |
|
MD5 | c238cd135cb94620839b7edee4cb8ecf |
|
BLAKE2b-256 | bc9b1d9afaf857a122291a11210ec3fd004884f3c2c5083910c250fee70bd083 |
Hashes for pytomlpp-0.3.4-cp39-cp39-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64ab672399b33e2fc21c6a48cab2b0e8ef7689f369c1016573995f665f2dafa9 |
|
MD5 | d03b30962d8f9bb902a1c16fab07d6b7 |
|
BLAKE2b-256 | 664bf6f372b9afdc369f71486f182c025f9320055080b534f2e34c5552f50d8c |
Hashes for pytomlpp-0.3.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e9866497bc78eff936b0307a484bd0568f05ca683eb8615168b55da92d32266 |
|
MD5 | ba3e8221f6ce3b7b69accc16382cd16a |
|
BLAKE2b-256 | 5db37f7a09bfb01059ad079d71591a7ab876051777015d54b7485456a7f3b65f |
Hashes for pytomlpp-0.3.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 118682630bd46ef380f8ee9f378ea6d362bf0065bbd0d5ad874509936f2f81e0 |
|
MD5 | d9e2584d25bcd1e48f8e23934e4cc5d4 |
|
BLAKE2b-256 | 71a8cbf18b635586fc650a71b10c87c2aa77301ed2a79099294ca5f39e92030c |
Hashes for pytomlpp-0.3.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f610df219e69d73f47b3ed7b8f1e420f74b7ccd7e23c2d5ada33c5c36029504f |
|
MD5 | 2e8bcd42387c54a0ee67d3b8d1ef237e |
|
BLAKE2b-256 | 7b64daf665489f68147302f8fe2e86c8de880b470092791a5958fcd892f5f0f4 |
Hashes for pytomlpp-0.3.4-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e747b4a7c7223b8e16369ee9912a3fbd43304806fa69ebb70b3f7ab9dd414dd |
|
MD5 | de4462ec5d377b4bf7bdf2564e217429 |
|
BLAKE2b-256 | f4dbd3bd2c8556a2f7dacc81e8bdcced14368df0e3b8de29a488d0e6997dc1fa |
Hashes for pytomlpp-0.3.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e03e1dbe3cec41482089e5df1413fd46a6f908e6d284ead806da6f385be70284 |
|
MD5 | d55fbd3fcbfd94685b81fa8b5f5e8bf3 |
|
BLAKE2b-256 | e5666d8ab6b6f9a6a9fe6cc1898baa157c95157136fa59ac5ecc2ebca5fc42bb |
Hashes for pytomlpp-0.3.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35bc9b8508793e3be734baebae353afdd5e6ef0c69a3a03053301012d7fa361f |
|
MD5 | 627367fceeaff79bb34ce1ac6fe0284f |
|
BLAKE2b-256 | a8e88d9634bab9937b6ee53b9b2f55a60d9bc01ec50f5439b1a432b3d624f3a0 |
Hashes for pytomlpp-0.3.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf89f1da5a816ccbf6422a14dec3f8b28b329c9d89b210ece01d466400d2569 |
|
MD5 | 3d05e640e9b74d1079d11f62007f5709 |
|
BLAKE2b-256 | 1e7613cb74ec21bb104772860bfbe3ae25ed31e09d7f91b58899607fafacb950 |
Hashes for pytomlpp-0.3.4-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8762de85bf9a019c6395212e86c63b61e916883dbb13691abc1a48a09849cf5 |
|
MD5 | ba08ca83545e2c3db2dbcf95824f679d |
|
BLAKE2b-256 | 4528224427b48b60225186d100e7619b234fba373220a93fc5ddd9447d6e3e94 |
Hashes for pytomlpp-0.3.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 497e247f2dd7acedbf6e40873be663193a73daab2091cd02342f48e475dfd0e0 |
|
MD5 | 6ee23cf44874504fccecde6bd2987863 |
|
BLAKE2b-256 | 1d8c5554b1526b7d9c214ef7af8280b2bbbec8696515e7cba9ff687a3b0e3350 |
Hashes for pytomlpp-0.3.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 324946016b29c4df129b611950bd6f8d9d006bf98091a53ffe631fddc58b72ee |
|
MD5 | 71f7afefad608c06d532cfeb0abce2ce |
|
BLAKE2b-256 | 5902b5f8b0112b9ac8716cbd85310d30430358ecd15a793caca8735c57a04fbd |
Hashes for pytomlpp-0.3.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 277dcbaa6046229924db65f40cfd37a2b9aa1a968ca2dc65e82ed8fb01bb983b |
|
MD5 | daff80802be79bad5534073c1a96196e |
|
BLAKE2b-256 | 06d94f4f8b248283df371b0981c2fc05e8254333345a010a139de5ab74c1d546 |
Hashes for pytomlpp-0.3.4-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ba1706f41a9c8b3412d447ce9804b286cc42506a6766f5c27494e72ef0b076a |
|
MD5 | f99c4151250e1ffeeaa2efe931a123db |
|
BLAKE2b-256 | 525e19b1e30b125c4ebea82f592dd1d10ff1e6f3a4be11f49b53d9fb97170d76 |
Hashes for pytomlpp-0.3.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b3e4c39ce83237d097fafd1155bd6e385aa34ed9bd6952e1e239b93a3081ce3 |
|
MD5 | e8165965825ff4dc93cc7673eb06fecb |
|
BLAKE2b-256 | d352567ae088ffbd49ae24dbc301242f2ac83d6c9db0bf8130003027a120e3b2 |
Hashes for pytomlpp-0.3.4-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d68662460201bff14c19f254212a48c0f85abfe027a4e13470cadb3ce28e378 |
|
MD5 | 95ebd5b211948a0a2cbfbb3f8d8148b8 |
|
BLAKE2b-256 | 0db33fe21fc511c308e43603eae7d635882c707464b616d7675c430b74941a97 |
Hashes for pytomlpp-0.3.4-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a14bd2007f37b57107e85531696d77292d82f9bebfe891cf14eaaebdc3ad0fe |
|
MD5 | f615cff8e572ab4c91b461ffe0e0b48e |
|
BLAKE2b-256 | fb85b68b8cb6a3bf3cb082ea92c9f8a18fa78a3101fb7c4928b12e5e20c07fa5 |
Hashes for pytomlpp-0.3.4-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b0313706c635055074d3f5df00d5af6345a4a39bde1ab206be679ce766882dd |
|
MD5 | a7de26b1cf50ccc6681ba0307d7236de |
|
BLAKE2b-256 | 8e865fbb5232d7255e1011191c57fbbef5ae88f73d1fe6165d6db343b9501f16 |
Hashes for pytomlpp-0.3.4-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0edf57d6a3902df2256b42ad2d1993763bd100df030c049c51dd40ab27d63f9c |
|
MD5 | 076ed5f36b1816ae4a8b9d01b0bbc44a |
|
BLAKE2b-256 | f2b66939c384ea67e81b2d4705ea1a3c4012f60362a41f9e0e93ad3e55a0b9ab |