# Buildsheet autogenerated by ravenadm tool -- Do not edit.
NAMEBASE= python-tomli-w
VERSION= 1.2.0
KEYWORDS= python
VARIANTS= v13 v14
SDESC[v13]= Lil' TOML writer (3.13)
SDESC[v14]= Lil' TOML writer (3.14)
HOMEPAGE= https://github.com/hukkin/tomli-w
CONTACT= Python_Automaton[python@ravenports.com]
DOWNLOAD_GROUPS= main
SITES[main]= PYPIWHL/c7/18/c86eb8e0202e32dd3df50d43d7ff9854f8e0603945ff398974c1d91ac1ef
DISTFILE[1]= tomli_w-1.2.0-py3-none-any.whl:main
DIST_SUBDIR= python-src
DF_INDEX= 1
SPKGS[v13]= single
SPKGS[v14]= single
OPTIONS_AVAILABLE= PY313 PY314
OPTIONS_STANDARD= none
VOPTS[v13]= PY313=ON PY314=OFF
VOPTS[v14]= PY313=OFF PY314=ON
DISTNAME= tomli_w-1.2.0.dist-info
GENERATED= yes
[PY313].USES_ON= python:v13,wheel
[PY314].USES_ON= python:v14,wheel
[FILE:2013:descriptions/desc.single]
[Build Status]
[![codecov.io]](https://codecov.io/gh/hukkin/tomli-w)
[PyPI version]
# Tomli-W
> A lil' TOML writer
**Table of Contents** *generated with [mdformat-toc]*
- [Intro]
- [Installation]
- [Usage]
- [Write to string]
- [Write to file]
- [FAQ]
- [Does Tomli-W sort the document?]
- [Does Tomli-W support writing documents with comments?]
- [Can I customize insignificant whitespace?]
- [Why does Tomli-W not write a multi-line string if the string value
contains newlines?]
- [Is Tomli-W output guaranteed to be valid TOML?]
## 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
```bash
pip install tomli-w
```
## Usage
### Write to string
```python
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
```
### Write to file
```python
import tomli_w
doc = {"one": 1, "two": 2, "pi": 3}
with open("path_to_file/conf.toml", "wb") as f:
tomli_w.dump(doc, f)
```
## 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?
No.
### Can I customize insignificant whitespace?
Indent width of array content can be configured via the `indent` keyword
argument.
`indent` takes a non-negative integer, defaulting to 4.
```python
import tomli_w
doc = {"fruits": ["orange", "kiwi", "papaya"]}
expected_toml = """\
fruits = [
"orange",
"kiwi",
"papaya",
]
"""
[FILE:120:distinfo]
188306098d013b691fcadc011abd66727d3c414c571bb01b1a174ba8c983cf90 6675 python-src/tomli_w-1.2.0-py3-none-any.whl