Convert REQUIRE to Project.toml and Manifest.toml

This is what I do:

  1. Steal the format from an existing Project.toml, e.g. https://github.com/JuliaLang/Pkg.jl/blob/master/Project.toml, and create your own Project.toml in your repository.
  2. You probably only need “name” and “uuid” in the top section, so you can delete the rest or change it for your package if you want.
  3. Replace the package name there with your package name.
  4. Get a uuid for your package using using Pkg; Pkg.METADATA_compatible_uuid(pkg_name) where pkg_name is the name of your package as a String without .jl (watch your spelling!).
  5. Replace the uuid in the Project.toml and delete the list of deps there, keeping the header. Save the file!
  6. cd into the repository of the package, most likely in your .julia/dev/pkg_name folder.
  7. In a Julia session, run ]activate .
  8. Open the REQUIRE file in another window.
  9. Run ]add dep_name for all your dependencies in the REQUIRE file. This will automatically update the Project.toml and Manifest.toml, creating the latter if it doesn’t exit.
  10. You may want to add an extra [compat] section as shown in Pkg · The Julia Language to support certain versions of packages or Julia.
  11. Add your test dependencies as well and then copy the test deps’ lines from the Project.toml file’s [deps] section to the [extras] section, and list the package names in the [targets] section as shown in https://github.com/KristofferC/JuAFEM.jl/blob/master/Project.toml.

And now you should be having Project.toml and Manifest.toml files in your repo. Apparently, you still need to keep your REQUIRE files there for registered packages. Anyways after doing the above, you can close that Julia session and open a new one in the default v1.0 environment, and pretend like none of this had to happen. Hopefully, some expert can correct me if I got something off.

11 Likes