Need help making my first Julia package

Hello,

I am writing a Julia package that I want to make publicly available on GitHub. I am been following the instructions on this website:

https://docs.julialang.org/en/v1/stdlib/Pkg/

I am mostly done. I used pkg> add ... to indicate the package dependencies, as indicated on the web page, and that generated appropriate Manifest.toml and Project.toml files. I created the functions that I want to put in the package, and I’ve added unit tests. But I’m struggling with the next few steps:

  1. How do I probe the PATH to the package install directory? My package comes with a data file that I need to read to make the package work.

  2. If I just put the package directory on GitHub, how would people install it? I’d like to add a README.md file with basic installation instructions.

  3. Following up on the previous question, how do I register the package so that people can type Pkg.add("Planets") and have that work?

  4. I don’t have a REQUIRE file. Is that no longer needed for Julia 0.7 and later? Has it been fully replaced by Manifest.toml and Project.toml?

  5. Julia packages on GitHub usually end in .jl. Is that a requirement or just a popular convention? What happens if I don’t do that? I ask because I think I might want to leave the door open to using the same repository for a Python package.

Thanks for the help.

  1. In any file @__DIR__ returns a directory containing that file, you can calculate path to your data relative to this dir.

  2. With Pkg3 users can install packages directly from repository using ]add http://github.com/your_username/Repo.jl.

  1. Since the repo can also be used as a Julia package, I’d still split Julia and Python code (you may want to reference one from another e.g. to download data files).
1 Like

Thanks!

  1. From my understanding REQUIRE is not required anymore if your package only supports v0.7 and up but if you want to register your package with METADATA.jl you will need it.

Thanks. What is METADATA.jl? Do I need that?

You don’t need it unless you want to publish your package, i.e. users would install it by ] add PackageName instead of ] add http://github.com/your_username/PackageName.jl.

Details: http://www.stochasticlifestyle.com/finalizing-julia-package-documentation-testing-coverage-publishing/