# How to solve problem with TOML.jl?

**URL:** https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319
**Category:** General Usage
**Created:** [February 25, 2018, 6:01pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319 "2018-02-25T18:01:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)
#### Post date: [February 25, 2018, 6:01pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/1 "2018-02-25T18:01:29Z")

</div>

I just saw nice [dependency graph](https://github.com/JuliaLang/julia/issues/25951) from @kristoffer.carlsson

Code starts with:

```julia
cd("/Users/kristoffer/julia/stdlib")
import TOML

```

So I tried it and get:

```julia
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 [https://github.com/pygy/TOML.jl](https://github.com/pygy/TOML.jl) which is obsolete.

By digging at [https://github.com/JuliaLang/Pkg3.jl](https://github.com/JuliaLang/Pkg3.jl) I see that there is [https://github.com/JuliaLang/Pkg3.jl/tree/master/ext/TOML](https://github.com/JuliaLang/Pkg3.jl/tree/master/ext/TOML) which is “borrowed” from [https://github.com/wildart/TOML.jl](https://github.com/wildart/TOML.jl) .

But [https://github.com/JuliaLang/Pkg3.jl/blob/master/ext/TOML/README.md](https://github.com/JuliaLang/Pkg3.jl/blob/master/ext/TOML/README.md) says: " **Installation:** julia\> Pkg.clone(“[https://github.com/wildart/TOML.jl.git](https://github.com/wildart/TOML.jl.git)”) "

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?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [February 25, 2018, 6:08pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/2 "2018-02-25T18:08:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Liso](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Liso](https://discourse.julialang.org/u/Liso)
#### Post date: [February 25, 2018, 6:39pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/3 "2018-02-25T18:39:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![richardreeve](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/richardreeve/32/2257_2.png) [@richardreeve](https://discourse.julialang.org/u/richardreeve)
#### Post date: [May 30, 2018, 4:33pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/4 "2018-05-30T16:33:08Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [May 30, 2018, 5:49pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/5 "2018-05-30T17:49:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![richardreeve](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/richardreeve/32/2257_2.png) [@richardreeve](https://discourse.julialang.org/u/richardreeve)
#### Post date: [May 30, 2018, 8:59pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/6 "2018-05-30T20:59:57Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [May 30, 2018, 10:14pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/7 "2018-05-30T22:14:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bluehope](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluehope/32/4959_2.png) [@bluehope](https://discourse.julialang.org/u/bluehope)
#### Post date: [August 12, 2018, 1:09pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/8 "2018-08-12T13:09:28Z")

</div>

Hi,

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 [https://github.com/wildart/TOML.jl/](https://github.com/wildart/TOML.jl/)?

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

```nohighlight
import Pkg
Pkg.TOML.parsefile

```

---

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [August 12, 2018, 3:21pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/9 "2018-08-12T15:21:15Z")

</div>

You can do

```nohighlight
using Pkg
using Pkg.TOML

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [August 12, 2018, 3:42pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/10 "2018-08-12T15:42:20Z")

</div>

You can, but it is not recommended AFAIK:

[https://github.com/JuliaLang/Pkg.jl/issues/545](https://github.com/JuliaLang/Pkg.jl/issues/545)

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

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 12, 2018, 3:43pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/11 "2018-08-12T15:43:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [August 12, 2018, 5:39pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/12 "2018-08-12T17:39:25Z")

</div>

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`?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 12, 2018, 6:46pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/13 "2018-08-12T18:46:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [August 12, 2018, 9:21pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/14 "2018-08-12T21:21:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 12, 2018, 10:32pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/15 "2018-08-12T22:32:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![bluehope](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluehope/32/4959_2.png) [@bluehope](https://discourse.julialang.org/u/bluehope)
#### Post date: [August 13, 2018, 2:51am UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/16 "2018-08-13T02:51:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)
#### Post date: [August 13, 2018, 5:33am UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/17 "2018-08-13T05:33:35Z")

</div>

> [@kristoffer.carlsson](#):
>
> Would be interesting to see what the problem is if you can share the file.

The file contains

```julia
[test]
test = [0.0, 1.0]

```

and I get

```julia
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
Stacktrace:
 [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

```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [August 13, 2018, 12:20pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/18 "2018-08-13T12:20:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [August 13, 2018, 4:46pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/19 "2018-08-13T16:46:13Z")

</div>

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

> **[GitHub - chakravala/VerTeX.jl: Typeset scattered graph data rewriter based on...](https://github.com/chakravala/VerTeX.jl)**
>
> Typeset scattered graph data rewriter based on LaTeX nodes - GitHub - chakravala/VerTeX.jl: Typeset scattered graph data rewriter based on LaTeX nodes

Works excellent

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 13, 2018, 5:06pm UTC](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319/20 "2018-08-13T17:06:49Z")

</div>

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

[Next page](https://discourse.julialang.org/t/how-to-solve-problem-with-toml-jl/9319.md?page=2)
