Introduction
TOML is a text format for configuration files, made to be easy for people to read and to map without doubt onto a table of keys and values. Tom Preston-Werner, a co-founder of GitHub, created it in 2013, and version 1.0.0 was released in 2021.
It is the configuration format of the Rust package manager Cargo
(Cargo.toml), of Python projects (pyproject.toml) and of
many other tools.
Structure
A TOML file is UTF-8 text with no header. It is made of lines of three kinds:
- a key and value:
name = "value", where a key can be dotted, as inserver.port = 8080 - a table header:
[section], after which keys belong to that table - an array of tables header:
[[item]], which starts a new table each time it appears
Values are strings (basic in double quotes, literal in single quotes, and multi-line
forms with three quotes), integers, floats, booleans, dates and times in RFC 3339 form,
arrays in [ ] and inline tables in { }. Comments start with
#. A key may be defined only once.
Also used for
Links
Software
- Visual Studio Code (Windows, macOS, Linux)
- Sublime Text (Windows, macOS, Linux)
- Cargo, the Rust package manager, which reads
Cargo.toml
Developers
- tomllib, Python’s built-in reader, from Python 3.11
- toml, Rust
- BurntSushi/toml, Go
Reference
- TOML v1.0.0, the specification