TOML
{{short description|Configuration file format}}
{{infobox file format
| name = TOML
| icon = TOML Logo.svg
| icon_size = 32
| extension = .toml
| mime = application/toml
| developer = {{ubl|Tom Preston-Werner|Community}}
| released = {{Start date and age|2013|02|23|df=yes}}
| open = Yes
| url = {{conditionalURL}}
| latest release version = {{wikidata|property|reference|P348}}
| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| genre = Data interchange
}}
Tom's Obvious, Minimal Language (TOML, originally Tom's Own Markup Language{{Cite web |last=Preston-Werner |first=Tom |date=2013-02-24 |title=Initial commit · toml-lang/toml@84db252 |url=https://github.com/toml-lang/toml/commit/84db252ed19561ef6f966cb3e470f04b32800add |url-status=live |archive-url=https://web.archive.org/web/20240615191325/https://github.com/toml-lang/toml/commit/84db252ed19561ef6f966cb3e470f04b32800add |archive-date=2024-06-15 |access-date=2024-06-15 |website=GitHub}}) is a file format for configuration files.{{Cite web |last1=Preston-Werner |first1=Tom |author-link1=Tom Preston-Werner |last2=Gedam |first2=Pradyun |date=January 11, 2021 |title=TOML: English v1.0.0 |url=https://toml.io/en/v1.0.0 |access-date=January 27, 2024 |archive-date=January 29, 2024 |archive-url=https://web.archive.org/web/20240129045431/https://toml.io/en/v1.0.0 |url-status=live }} It is intended to be easy to read and write due to obvious semantics which aim to be "minimal", and it is designed to map unambiguously to a dictionary. Originally created by Tom Preston-Werner, its specification is open source. TOML is used in a number of software projects{{Cite web |url=https://drewdevault.com/2021/07/28/The-next-YAML.html |title=My wish-list for the next YAML |first=Drew |last=DeVault |date=2021-07-28 |quote=YAML is both universally used, and universally reviled. It has a lot of problems, but it also is so useful in solving specific tasks that it’s hard to replace. Some new kids on the block (such as TOML) have successfully taken over a portion of its market share, but it remains in force in places where those alternatives show their weaknesses. |access-date=2021-07-28 |archive-date=2024-03-09 |archive-url=https://web.archive.org/web/20240309125915/https://drewdevault.com/2021/07/28/The-next-YAML.html |url-status=live }}{{Cite web |title=TOML: Tom's Obvious Minimal Language |url=https://toml.io/en/ |access-date=2022-08-08 |website=toml.io |archive-date=2022-08-08 |archive-url=https://web.archive.org/web/20220808093947/https://toml.io/en/ |url-status=live }} and is implemented in many programming languages.{{Cite web |date=23 May 2022 |title=toml-lang/toml |url=https://github.com/toml-lang/toml |website=GitHub |access-date=16 December 2016 |archive-date=15 February 2017 |archive-url=https://web.archive.org/web/20170215183959/https://github.com/toml-lang/toml |url-status=live }}
Syntax
TOML's syntax primarily consists of key = value
pairs, [section names]
, and #
(for comments). TOML's syntax somewhat resembles that of .INI files, but it includes a formal specification, whereas the INI file format suffers from many competing variants.
Its specification includes a list of supported data types: string, integer, float, boolean, datetime, array, and table.
=Example=
- This is a TOML document.
title = "ImpalaPay Co."
[database]
server = "192.168.1.1"
ports = [ 8000, 8001, 8002 ]
connection_max = 5000
enabled = true
- Line breaks are okay when inside arrays
hosts = [
"alpha",
"omega"
]
[servers]
# Indentation (tabs and/or spaces) is allowed, but not required
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
Use cases
TOML is used in a variety of settings (some related to its creator), such as:
- Static site generators like Jekyll and Hugo.
- Python programming language{{Cite web |title=tomllib — Parse TOML files |url=https://docs.python.org/3/library/tomllib.html |access-date=2023-07-08 |website=Python documentation |archive-date=2024-06-11 |archive-url=https://web.archive.org/web/20240611135426/https://docs.python.org/3/library/tomllib.html |url-status=live }} and package manifest{{Cite web |title=PEP 518 – Specifying Minimum Build System Requirements for Python Projects {{!}} peps.python.org |url=https://peps.python.org/pep-0518/#specification |access-date=2025-02-04 |website=Python Enhancement Proposals (PEPs) |language=en}}
- Rust package manifest{{Cite web |title=The Manifest Format - The Cargo Book |url=https://doc.rust-lang.org/cargo/reference/manifest.html |access-date=2023-07-08 |website=doc.rust-lang.org |archive-date=2019-08-26 |archive-url=https://web.archive.org/web/20190826013342/https://doc.rust-lang.org/cargo/reference/manifest.html |url-status=live }}
- Julia project setting and package manifest{{Cite web |title=10. Project.toml and Manifest.toml · Pkg.jl |url=https://pkgdocs.julialang.org/v1/toml-files/ |access-date=2023-07-08 |website=pkgdocs.julialang.org |archive-date=2023-07-08 |archive-url=https://web.archive.org/web/20230708105355/https://pkgdocs.julialang.org/v1/toml-files/ |url-status=live }}
- Blender add-on manifest.
- Gradle version cataloghttps://docs.gradle.org/current/userguide/version_catalogs.html
Criticism
TOML has been criticized on a number of points:{{refn|name=what-is-wrong-with-toml|[https://hitchdev.com/strictyaml/why-not/toml/ What is wrong with TOML?]}}{{refn|name=an-ini-critique-of-toml|[https://github.com/madmurphy/libconfini/wiki/An-INI-critique-of-TOML An INI critique of TOML]}}
- TOML is verbose; it is not DRY and is syntactically noisy.
- TOML's hierarchies can be difficult to infer from syntax alone.
- Overcomplication: TOML has too many features.
- In TOML, the syntax determines the data types ("syntax typing").
See also
- {{Section link|Configuration file|Comparison}}
- INI file
References
{{reflist}}
External links
- {{official website}}
{{Data Exchange}}
Category:Computer file formats