I seem to be unable to use Literate when the script I’m trying to convert tries to load an artifact. The full setup - all files in the same folder - is printed at the bottom of this post.
- If I execute the script by activating the package and then using
include("test.jl")
it executes correctely. - If I activate the package followed by
using Literate
Literate.markdown("test.jl"; execute=true)
I get the following error message:
[ Info: generating markdown page from `~/gits/ACE1pack/tmp/test.jl`
ERROR: LoadError: Cannot locate '(Julia)Artifacts.toml' file when attempting to use artifact 'TiAl_tutorial' in 'Main.var"##292"'
in expression starting at string:1
in expression starting at string:1
when executing the following code block in file `~/gits/ACE1pack/tmp/test.jl`
# ```
data_file = joinpath(artifact"TiAl_tutorial", "TiAl_tutorial.xyz")
# ```
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] execute_block(sb::Module, block::String; inputfile::String)
@ Literate ~/.julia/packages/Literate/PIFdc/src/Literate.jl:822
[3] execute_markdown!(io::IOBuffer, sb::Module, block::String, outputdir::String; inputfile::String, flavor::Literate.DocumenterFlavor, image_formats::Vector{Tuple{MIME, String}})
@ Literate ~/.julia/packages/Literate/PIFdc/src/Literate.jl:567
[4] markdown(inputfile::String, outputdir::String; config::Dict{Any, Any}, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:execute,), Tuple{Bool}}})
@ Literate ~/.julia/packages/Literate/PIFdc/src/Literate.jl:546
[5] top-level scope
@ REPL[6]:1
I have found no information anywhere on how to use artifacts within Literate.jl
- any suggests or pointes to working examples would be greatly appreciated.
DETAILS / FILE CONTENTS
# Project.toml
[deps]
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
# Artifacts.toml
[TiAl_tutorial]
git-tree-sha1 = "b437d7d5fac4424b8203d0afc31732879d3da5b2"
lazy = true
[[TiAl_tutorial.download]]
sha256 = "3677174b6ab4adfd07dc03235b797c88234515df793d8603cce5ab7ce0db637d"
url = "https://github.com/ACEsuit/ACEData/blob/master/trainingsets/TiAl_tutorial.tar.gz?raw=true"
# test.jl
# We need LazyArtifacts to obtain a dataset
using LazyArtifacts
# ... try to obtain the dataset
data_file = joinpath(artifact"TiAl_tutorial", "TiAl_tutorial.xyz")