How to solve problem with TOML.jl?

I just saw nice dependency graph from @kristoffer.carlsson

Code starts with:

import TOML

So I tried it and get:

ERROR: ArgumentError: Module TOML not found in current path.
Run `Pkg.add("TOML")` to install the TOML package.

So far so good everything was expected.
Problem is that Pkg.add("TOML") install which is obsolete.

By digging at I see that there is which is “borrowed” from .

But says: "Installation: julia> Pkg.clone(“”) "

So now I am not sure if it is good idea to install TOML.jl in this time.

But probably Pkg.add behaviour for this package could be changed? (at least not to install package which is incompatible with Julia version)

What is best way to fix this?

Since the package is not registered, you can just do Pkg.clone like you thought.

Is it not a problem that obsolete package with same name is registered?

Now Pkg3/Pkg is the default package handler for 1.0, and Pkg depends on TOML, isn’t it odd that it’s unregistered and we have to install it separately if we want to use TOML ourselves?

1 Like

Yes, sorting this out is future work. The priority was on getting something working.

Fair enough - is this because it’ll be tricky to upgrade a Pkg dependency using Pkg if TOML needs changing? Or just a pure time issue?

Time and effort. @wildart did an early prototype using his own TOML parser implementation, which is the one bundled with Pkg3. The registered TOML parser didn’t handle some of the formats that we needed and it wasn’t worth spending time on TOML parsing with so much other work to do. At no point since then has it been a top priority to unbundle the TOML parser and finalize its API.


From Julia 0.7 / 1.0, it looks like stdlib/Pkg/ext/TOML Here is the modified version from @wildart to the latest Julia.
How about asking for PR to

By the way, Parsing TOML in latest Julia (0.7/1.0) is any way possible as bellow for now.

import Pkg

You can do

using Pkg
using Pkg.TOML

You can, but it is not recommended AFAIK:

I wish this changed though. It is a shame that there is an up-to-date TOML package but it is not officially supported.

Note that the TOML inside Pkg is an implementation detail that is not considered stable. However, as been said, at some point it would be good to upstream the changes in there.

Its clear that you do not claim that it is stable (which is not done for any stdlib by the way) but the question remains: Can one use Pkg.TOML as a drop-in replacement for wildart/TOML.jl?

Try it, and if it works it works… I haven’t tested more than that it works with Pkg.

Seems not, I have a file that parsed fine with wildart/TOML.jl at julia 0.6 but does not with Pkg.TOML. But that should not be your problem.

I am curious if it is better migrating wildart/TOML.jl to 0.7 or taking Pkg.TOML as the start point. I will do this when no-one beets me to it (need to migrate several packages). Might be good to put this in JuliaIO.


Would be interesting to see what the problem is if you can share the file.

1 Like

It seems good idea to put TOML officially in JuliaIO.
As long as the Pkg mananger works as a TOML base, the official support seems to be natural.

1 Like

The file contains

test = [0.0, 1.0]

and I get

julia> Pkg.TOML.parsefile("test.toml")
WARNING: Base.Pkg is deprecated, run `using Pkg` instead
 in module Main
ERROR: MethodError: no method matching get(::String, ::String)
Closest candidates are:
  get(::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:63
 [1] numdatetime(::Pkg.TOML.Parser{IOStream}, ::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:391
 [2] value(::Pkg.TOML.Parser{IOStream}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:723
 [3] array(::Pkg.TOML.Parser{IOStream}, ::Int64) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:657
 [4] value(::Pkg.TOML.Parser{IOStream}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:719
 [5] keyvalues(::Pkg.TOML.Parser{IOStream}, ::Pkg.TOML.Table) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:749
 [6] parse(::Pkg.TOML.Parser{IOStream}) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/parser.jl:881
 [7] parse(::IOStream) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/TOML.jl:32
 [8] #open#298(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::typeof(Pkg.TOML.parse), ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
 [9] open at ./iostream.jl:367 [inlined]
 [10] parsefile(::String) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/Pkg/ext/TOML/src/TOML.jl:46
1 Like

I think that would be great. But I also understand why the authors of Pkg just worked on a copy directly: one can use TOML as a package, but that is tricky when the software in question is the package manager itself. I think that a viable solution would be having it in the standard libraries, but that also has trade-offs.


I’ve been successfully using the Pkg.TOML library for many months now,

Works excellent

(Except if you use arrays of floats apparently, hehe). But we should fix that.