Best way to create config files? / Does Julia support .toml natively?



I want to write a program that reads a config file with straight forward key-value information. The sort of thing that you could do with a TOML or YAML file. I’m wondering if there is a “standard” solution in Julia? I had assumed that TOML would be supported natively because it’s used by the Julia package manager. But that doesn’t seem to be the case. I’ve only found TOML.jl which doesn’t look quite like a polished product.

Anyway, I might just end up choosing between TOML.jl and YAML.jl. I just wanted to know if there was something obvious that I’ve missed.

Thanks for the help.



Nope, I think you haven’t missed anything obvious. The Julia package manager actually uses its own updated version of TOML.jl which lives inside the Pkg repository: . You can access that internal TOML package via using Pkg; Pkg.TOML, but I wouldn’t necessarily recommend it for production code: I don’t think it’s guaranteed that Pkg.TOML will always be accessible or have a stable internal API in future versions of Pkg and Julia.

Fortunately, there is work underway right now to turn that internal TOML module into part of the Julia standard library: Once that’s done, you’ll be able to do using TOML without having to install anything.

Until that time, you could use YAML.jl, or JSON.jl, or you could use Pkg.TOML (as long as you’re willing to change your code when it becomes a standard library in the future).



Exactly what I needed to know. Thanks!



The package ConfParser.jl seems quite convenient and well-maintained.




It would be really nice if we can get TOML split off into a separate package so that it’s easier to use and maintain. I strongly prefer it to YAML, which is a bit of a mess in my opinion.



It is WIP, see

I plan to contribute in the medium run.

1 Like