GithubHelp home page GithubHelp logo

artifacthelpers.jl's Introduction

ArtifactHelpers.jl

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Unit Tests - Unix/Linux Unit Tests - Windows

This project follows the semver pro forma and uses the git-flow branching model.

Overview

The ArtifactHelpers package provides a set of helper functions that overlay Julia's Artifact framework to assist with binding, initialisation, and possible recreation of Artifacts.

Installation

(v1.1) pkg> add https://github.com/CiaranOMara/ArtifactHelpers.jl

Usage Example

This example shows a usage pattern for ArtifactHelpers within a package/project. This pattern makes use of Julia's build system. The build system decouples dependencies required to generate the Artifacts from the package as well as provide a means in which to distribute and recreate Artifacts across systems.

# Project layout.
./
├── Artifacts.toml
├── Project.toml
├── README.md
├── deps
│   ├── Project.toml
│   └── build.jl
└── src
    └── <package_name>.jl

When a package is first installed, Julia automatically runs the deps/build.jl file as part of the package build step. However, when working on the deps/build.jl file, builds can be triggered from the Julia REPL in pkg mode with the build command.

Shown below is an example of a deps/build.jl file that performs the initial binding of Artifacts to the Artifacts.toml file.

using ArtifactHelpers

artifacts_toml = joinpath(@__DIR__, "..", "Artifacts.toml")

bind_artifact!(artifacts_toml, File("http://somwhere/random.csv"), force = false, verbose = true)
bind_artifact!(artifacts_toml, Zip("http://somwhere/random.zip"), force = false, verbose = true)
bind_artifact!(artifacts_toml, AutoDownloadable("http://somwhere/random.tar.gz"), force = false, verbose = true)

bind_artifact!(artifacts_toml, "Processed", force = false, verbose = true) do path_artifact #Note: this will create an artifact that is ready for use.
    # Do stuff ...
end

Once the Artifacts.toml file is populated, it should be committed to the git history so that the dual purpose build_artifact! method has the information it requires to verify recreated Artifacts.

After the Artifacts are setup they can be accessed with the artifact_path() method or the @artifact_str macro. Below is an example of populating the globals of ./src/<package_name>.jl with Artifact items.

module <package_name>

using Pkg.Artifacts

path_random_tar_gz = ""
random_csv = ""
path_random_zip = ""
path_processed = ""

function __init__()

    global path_random_tar_gz = abspath(artifact"random.tar.gz")

    global random_csv = joinpath(abspath(artifact"random.csv"), "random.csv")

    global path_random_zip = abspath(artifact"random.zip")

    global path_processed = abspath(artifact"processed")

end

# module code ...

end # module

Contributions

This package is still very much a work in progress. I haven't settled on a pattern and am very much open to suggestions and improvements.

Acknowledgements

artifacthelpers.jl's People

Contributors

ciaranomara avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

artifacthelpers.jl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.