Commit Artifacts.toml?

Hi,

I’m using artifacts to grab some testdata files using the method from the “working with artifacts” section in this blog.

Overall it is a pleasure to use it so big kudos to the developers!

I do have some questions w.r.t best practices though:

Currently there is one artifact per directory, where each directory contains multiple files and even subdirectories. Each directory is basically mapped to one testcase and there are more than a few of them.

From what I understand, it is not possible to use the download location property in Artifacts.toml with this setup, so the downloading code (basically copy-pasted from the blog) needs to be checked in with the tests, right?

Assuming this setup, is it the right thing to check in Artifacts.toml?

As of now it is checked in in the same folder as the tests.

One modification did was adding the force=true flag when binding the artifacts, or else the method fails in the case when an artifact is not present.

Is there some better way to do this? For example, could there be problems if the contents of the source files change?

The reason why I did the one artifact per directory is basically to make it a bit easier to debug failures as one then does not need to get the needed files from multiple artifact dirs, but Its not really a hard requirement I have.

Download code for reference:

# Copy paste from documentation basically
function get_artifact(name, location, ninputs, noutputs)
    artifacts_toml = joinpath(@__DIR__, "Artifacts.toml")
    ahash = artifact_hash(name, artifacts_toml)
    if isnothing(ahash) || !artifact_exists(ahash)
        ahash = create_artifact() do artifact_dir
            mkpath(joinpath(artifact_dir, "test_data_set_0"))

            download(joinpath(location, "model.onnx"), joinpath(artifact_dir, "model.onnx"))
            for i in 0:ninputs-1
                download(inputfile(location, i), inputfile(artifact_dir, i))
            end

            for i in 0:noutputs-1
                download(outputfile(location, i), outputfile(artifact_dir, i))
            end
        end

        bind_artifact!(artifacts_toml, name, ahash; force=true)
    end
    return ahash
end