![]() Artifacts can always be referred to by content hash, but are typically accessed by a name that is bound to a content hash in an Artifacts.toml file that lives in a project's source tree. Pkg provides an API for working with artifacts, as well as a TOML file format for recording artifact usage in your packages, and to automate downloading of artifacts at package install time. Then, make sure to add Pkg in your deps and set julia = "1.3" or higher in your compat section. To access this artifact from within a package you create, place the Artifacts.toml at the root of your package, adjacent to Project.toml. Println("git-tree-sha1: ", Tar.tree_hash(IOBuffer(inflate_gzip(filename)))) To create the Artifacts.toml you must compute two hashes: the sha256 hash of the download file, and the git-tree-sha1 of the unpacked content. If you have an existing tarball that is accessible via a url, it could also be accessed in this manner. Open(joinpath(rootpath, "bin", "socrates")) do file Since this tarball contains a folder bin, and a text file named socrates within that folder, we could access the content of that file as follows. If this Artifacts.toml file is placed in your current directory, then can be downloaded, unpacked and used with artifact"socrates". In this example, a single artifact, given the name socrates, is defined. Following is a minimal Artifacts.toml file which will permit the downloading of a file from. Currently, Pkg supports downloading of tarfiles (which can be compressed) from a URL. Pkg artifacts are declared in an Artifacts.toml file, which can be placed in your current directory or in the root of your package. This mechanism is also used to provide the binary dependencies for packages built with BinaryBuilder.jl. These containers, (called "Artifacts") can be created locally, hosted anywhere, and automatically downloaded and unpacked upon installation of your Julia package. These containers can contain platform-specific binaries, datasets, text, or any other kind of data that would be convenient to place within an immutable, life-cycled datastore. Pkg can install and manage containers of data that are not Julia packages.
0 Comments
Leave a Reply. |