TOML: Difference between revisions
Release info from Wikidata |
Opencooper (talk | contribs) format |
||
Line 2: | Line 2: | ||
{{infobox file format |
{{infobox file format |
||
| name = TOML |
| name = TOML |
||
| icon = |
| icon = TOML Logo.svg |
||
| extension = .toml |
| extension = .toml |
||
| mime = ''Not registered''{{ |
| mime = ''Not registered''{{efn|name=iana-media-types|There is a media type proposal for TOML as <code>application/toml</code>, but this has never been officially registered with the [[IANA]].<ref>https://www.iana.org/assignments/media-types/media-types.xhtml</ref>}} |
||
|_nomimecode = on |
|_nomimecode = on |
||
| developer = [[Tom Preston-Werner]] |
| developer = {{ubl|[[Tom Preston-Werner]]|Community}} |
||
| released = {{Start date and age|2013|02|23|df=yes}} |
| released = {{Start date and age|2013|02|23|df=yes}} |
||
| open = Yes |
| open = Yes |
||
Line 15: | Line 15: | ||
}} |
}} |
||
'''Tom's Obvious, Minimal Language''' ('''TOML''') is a [[file format]] for [[configuration file]]s.<ref>{{Cite web |last=Preston-Werner |first=Tom |author-link=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}}</ref> 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 (data structure)|dictionary]]. Originally created by [[Tom Preston-Werner]], its specification is [[open source]]. TOML is used in a number of software projects<ref |
'''Tom's Obvious, Minimal Language''' ('''TOML''') is a [[file format]] for [[configuration file]]s.<ref>{{Cite web |last=Preston-Werner |first=Tom |author-link=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}}</ref> 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 (data structure)|dictionary]]. Originally created by [[Tom Preston-Werner]], its specification is [[open source]]. TOML is used in a number of software projects<ref name="rust"/><ref>{{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.}}</ref><ref>{{Cite web |title=TOML: Tom's Obvious Minimal Language |url=https://toml.io/en/ |access-date=2022-08-08 |website=toml.io}}</ref> and is implemented in many programming languages.<ref name="auto">{{Cite web |date=23 May 2022 |title=toml-lang/toml |url=https://github.com/toml-lang/toml |website=GitHub}}</ref> |
||
==Syntax== |
==Syntax== |
||
TOML's syntax primarily consists of <code>key = value</code> pairs, <code>[section names]</code>, and <code>#</code> (for comments). TOML's syntax somewhat resembles that of [[INI file|.INI files]], but it includes a formal specification, whereas the INI file format suffers from many competing variants. |
TOML's syntax primarily consists of <code>key = value</code> pairs, <code>[section names]</code>, and <code>#</code> (for comments). TOML's syntax somewhat resembles that of [[INI file|.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: |
Its specification includes a list of supported data types: string, integer, float, boolean, datetime, array, and table. |
||
===Example=== |
===Example=== |
||
Line 34: | Line 34: | ||
enabled = true |
enabled = true |
||
# Line breaks are |
# Line breaks are okay when inside arrays |
||
hosts = [ |
hosts = [ |
||
"alpha", |
"alpha", |
||
Line 42: | Line 42: | ||
[servers] |
[servers] |
||
# Indentation (tabs and/or spaces) is allowed but not required |
# Indentation (tabs and/or spaces) is allowed, but not required |
||
[servers.alpha] |
[servers.alpha] |
||
ip = "10.0.0.1" |
ip = "10.0.0.1" |
||
Line 54: | Line 54: | ||
==Use cases== |
==Use cases== |
||
TOML is used in a variety of settings (some related to its creator), such as: |
TOML is used in a variety of settings (some related to its creator), such as: |
||
* [[Static site generator |
* [[Static site generator]]s like [[Jekyll (software)|Jekyll]] and [[Hugo (software)|Hugo]]. |
||
* [[Python (programming language)|Python]] programming language<ref>{{Cite web |title=tomllib — Parse TOML files |url=https://docs.python.org/3/library/tomllib.html |access-date=2023-07-08 |website=Python documentation}}</ref> |
* [[Python (programming language)|Python]] programming language<ref>{{Cite web |title=tomllib — Parse TOML files |url=https://docs.python.org/3/library/tomllib.html |access-date=2023-07-08 |website=Python documentation}}</ref> |
||
* [[Rust (programming language)|Rust]] package manifest<ref>{{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}}</ref> |
* [[Rust (programming language)|Rust]] package manifest<ref name="rust">{{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}}</ref> |
||
* [[Julia (programming language)|Julia]] project setting and package manifest<ref>{{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}}</ref> |
* [[Julia (programming language)|Julia]] project setting and package manifest<ref>{{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}}</ref> |
||
Line 62: | Line 62: | ||
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 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 [[Don' |
* TOML is verbose; it is not [[Don't repeat yourself|DRY]] and is syntactically noisy. |
||
* TOML's hierarchies can be difficult to infer from syntax alone. |
* TOML's hierarchies can be difficult to infer from syntax alone. |
||
* Overcomplication: Like [[YAML]], TOML has too many features. |
* Overcomplication: Like [[YAML]], TOML has too many features. |
||
* In TOML the syntax determines the data types ("syntax typing"). |
* In TOML, the syntax determines the data types ("syntax typing"). |
||
==See also== |
==See also== |
||
* {{Section link|Configuration file|Comparison}} |
* {{Section link|Configuration file|Comparison}} |
||
==Notes== |
|||
{{notelist}} |
|||
==References== |
==References== |
Revision as of 03:20, 12 May 2024
Filename extension |
.toml |
---|---|
Internet media type | Not registered[a] |
Developed by |
|
Initial release | 23 February 2013 |
Latest release | 1.0.0[2] 12 January 2021 |
Type of format | Data interchange |
Open format? | Yes |
Website | toml |
Tom's Obvious, Minimal Language (TOML) is a file format for configuration files.[3] 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[4][5][6] and is implemented in many programming languages.[7]
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[8]
- Rust package manifest[4]
- Julia project setting and package manifest[9]
Criticism
TOML has been criticized on a number of points:[10][11]
- TOML is verbose; it is not DRY and is syntactically noisy.
- TOML's hierarchies can be difficult to infer from syntax alone.
- Overcomplication: Like YAML, TOML has too many features.
- In TOML, the syntax determines the data types ("syntax typing").
See also
Notes
References
- ^ https://www.iana.org/assignments/media-types/media-types.xhtml
- ^ "Release 1.0.0". 12 January 2021. Retrieved 17 January 2021.
- ^ Preston-Werner, Tom; Gedam, Pradyun (January 11, 2021). "TOML: English v1.0.0". Retrieved January 27, 2024.
- ^ a b "The Manifest Format - The Cargo Book". doc.rust-lang.org. Retrieved 2023-07-08.
- ^ DeVault, Drew (2021-07-28). "My wish-list for the next YAML".
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.
- ^ "TOML: Tom's Obvious Minimal Language". toml.io. Retrieved 2022-08-08.
- ^ "toml-lang/toml". GitHub. 23 May 2022.
- ^ "tomllib — Parse TOML files". Python documentation. Retrieved 2023-07-08.
- ^ "10. Project.toml and Manifest.toml · Pkg.jl". pkgdocs.julialang.org. Retrieved 2023-07-08.
- ^ What is wrong with TOML?
- ^ An INI critique of TOML