Question

Julia has a packaging system based on Git repositories with specific directories (package skeleton obtained with Pkg.new("MyPackage")), and a METADATA file that list packages and the git servers they can be found on.

Pkg.init() initializes a local Julia installation with the default list of package, but what are the exact steps to write in one's package documentation in order to let prospective users try it out with Pkg.add("MyPackage"); require("MyPackage") ?

Was it helpful?

Solution

Any package source code can be manually placed in .julia/MyPackage. This can be done by unzipping a file, or checking out the package source from its repository manually. Once that is done, require("MyPackge") will work, just as with any official packages.

If you want to get users to try out Pkg.add("MyPackage"), you will need to provide them with your own METADATA repository. Clone the official repository, add your own package as usual. Then and ask users to initialise their julia package installation with Pkg.init("url to metdata git repository"). Once that is done, Pkg.add("MyPackage") will install the package from its own private git repository.

OTHER TIPS

For my own packages, I've been using the following boilerplate:

The FILL_ME_IN package is available through the Julia package system. If you’ve never used the package system before, you’ll need to run the following:

require("pkg")

Pkg.init()

Pkg.add("FILL_ME_IN")

If you have an existing library of packages, you can pull the FILL_ME_IN package into your library using similar commands:

require("pkg")

Pkg.add("FILL_ME_IN")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top