tomli-w
A lil' TOML writer
Decision gist · record as of 2026-08-14
Yes. Tomli-W is a lightweight, actively maintained library with zero runtime dependencies, a permissive license, and no known vulnerabilities. Install it if you need to write TOML files from Python. The only caveat is that it does not validate input—if you require guaranteed valid output, parse the result with an external parser afterward.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Installation is straightforward with no runtime dependencies.
- The package is actively maintained with a recent release on 2025-01-15 and a current repository, making it a low-friction addition.
License · maintenance · safety
permissive license (permissive) — Tomli-W is distributed under a permissive license, allowing use in both open-source and proprietary projects without significant restrictions.
last release 2025-01-15 (576 days) · last repo commit 2026-08-10 · 141 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 99,062,021 downloads/mo, #350 on PyPI
Alternatives
Verify before relying
pip install tomli-w
import tomli_w
doc = {"table": {"nested": {}}, "val": 1}
toml_string = tomli_w.dumps(doc)
with open("config.toml", "wb") as f:
tomli_w.dump(doc, f)- Whether output validation against TOML v1.0.0 spec is performed automatically or requires external parsing.
- Performance characteristics when serializing large or deeply nested dictionaries.
What it is and what it does
Tomli-W is a Python library for writing TOML configuration files. It takes Python dictionaries and converts them into valid TOML format, either as strings via `dumps()` or directly to files via `dump()`. It is fully compatible with TOML v1.0.0 and serves as the write-only counterpart to Tomli, a TOML parser.
The library preserves the insertion order of dictionary keys and offers customization options like indent width for arrays and multi-line string handling. It does not sort output, support comments, or validate input data—the documentation explicitly notes that malformed input can produce invalid TOML without raising an error, though proper input should always produce valid output.
Use it for
- Generate or update application configuration files in TOML format from Python data structures.
- Serialize settings dictionaries to TOML for storage or transmission to other tools.
- Build TOML documents programmatically in configuration management or deployment scripts.
- Convert parsed TOML back to file format after modifying configuration in memory.
- Create TOML output with customizable indentation for readability in different contexts.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Tomli-W is a lightweight, actively maintained library with zero runtime dependencies, a permissive license, and no known vulnerabilities. Install it if you need to write TOML files from Python. The only caveat is that it does not validate input—if you require guaranteed valid output, parse the result with an external parser afterward.
Install
tomli-w on PyPI
Before you install
Installation is straightforward with no runtime dependencies. The package is actively maintained with a recent release on 2025-01-15 and a current repository, making it a low-friction addition.
Requires Python 3.9 or later.
License in practice
Tomli-W is distributed under a permissive license, allowing use in both open-source and proprietary projects without significant restrictions.
Quickstart
pip install tomli-w
import tomli_w
doc = {"table": {"nested": {}}, "val": 1}
toml_string = tomli_w.dumps(doc)
with open("config.toml", "wb") as f:
tomli_w.dump(doc, f)
Verify before relying
- Whether output validation against TOML v1.0.0 spec is performed automatically or requires external parsing.
- Performance characteristics when serializing large or deeply nested dictionaries.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 576 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 99,062,021 / month, #350 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: tomli_w-1.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “toml writer library”
- tomli-wTomli-W serializes Python dictionaries to TOML format strings or…
- tomlrtReads and writes TOML files while preserving formatting, comments,…
- pytablewriterConverts tabular data into formatted tables for output in multiple…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also tomli · dict2xml · tomlrt · toml-sort · mdformat-toc · tox-toml-fmt · pytoml · rtoml · linear-tsv · dom-toml