A lil' TOML writer
Project description
Tomli-W
A lil' TOML writer
Table of Contents generated with mdformat-toc
Intro
Tomli-W is a Python library for writing TOML. It is a write-only counterpart to Tomli, which is a read-only TOML parser. Tomli-W is fully compatible with TOML v1.0.0.
Installation
pip install tomli-w
Usage
import tomli_w
doc = {"table": {"nested": {}, "val3": 3}, "val2": 2, "val1": 1}
expected_toml = """\
val2 = 2
val1 = 1
[table]
val3 = 3
[table.nested]
"""
assert tomli_w.dumps(doc) == expected_toml
FAQ
Does Tomli-W sort the document?
No, but it respects sort order of the input data,
so one could sort the content of the dict
(recursively) before calling tomli_w.dumps
.
Does Tomli-W support writing documents with comments, custom whitespace, or other stylistic choices?
No.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tomli_w-0.1.0.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file tomli_w-0.1.0.tar.gz
.
File metadata
- Download URL: tomli_w-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d058b518cf46d67f482efa4e3b65dd172f924f62bde301a978d03325a4e9a8c4 |
|
MD5 | 2989eedb0993e6c4d2865897c3bd4837 |
|
BLAKE2b-256 | 57aba90f9b3ec2087a3148789094ec7556dc07586d7693dd6b1a65ed617bc532 |
Provenance
File details
Details for the file tomli_w-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tomli_w-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3db4ca675ce615256c0810bf09c9007672282c8b8dbe486c28c53434a727c69 |
|
MD5 | 7a02c061351bd79d73803c10ae46732f |
|
BLAKE2b-256 | df2086121bcb0c7ee9aa259b38fd71009bca5868d6c25e66456691dad7c17a9f |