--- id: tomli-w version: "1.2.0" license: unclear license_treatment: permissive maintenance: active --- # tomli-w — A lil' TOML writer License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install tomli-w uv add tomli-w poetry add tomli-w ## Description [![Build Status](https://github.com/hukkin/tomli-w/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/hukkin/tomli-w/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush) [![codecov.io](https://codecov.io/gh/hukkin/tomli-w/branch/master/graph/badge.svg)](https://codecov.io/gh/hukkin/tomli-w) [![PyPI version](https://img.shields.io/pypi/v/tomli-w)](https://pypi.org/project/tomli-w) # Tomli-W > A lil' TOML writer **Table of Contents** *generated with [mdformat-toc](https://github.com/hukkin/mdformat-toc)* - [Intro](#intro) - [Installation](#installation) - [Usage](#usage) - [Write to string](#write-to-string) - [Write to file](#write-to-file) - [FAQ](#faq) - [Does Tomli-W sort the document?](#does-tomli-w-sort-the-document) - [Does Tomli-W support writing documents with comments?](#does-tomli-w-support-writing-documents-with-comments) - [Can I customize insignificant whitespace?](#can-i-customize-insignificant-whitespace) - [Why does Tomli-W not write a multi-line string if the string value contains... ## AI interpretation — verify before relying Tomli-W serializes Python dictionaries to TOML format, writing valid TOML documents to strings or files with configurable indentation and multiline string handling. Verdict: Tomli-W is a lightweight, actively maintained TOML serializer with no dependencies, permissive licensing, and zero known vulnerabilities. It is well-suited for projects that need to write TOML configuration files; note that it does not validate output or support comments, and users requiring strict validation should parse output with tomli.loads(). [View on SkillFed](https://skillfed.io/packages/tomli-w) · [View on PyPI](https://pypi.org/project/tomli-w/)