Julia: How to set the package Dev path?

Viewed 1415

I often ]dev Pkg but I want the devved packaged to be stored somewhere other than the default location for convenient access.

I don't want to change the path of the ]add Pkg. This seems to be controlled by the environment parameter DEPOT_PATH.

Is there a way to change only the path for dev Pkg, i.e. the path in which the dev package is stored?

2 Answers

You can set the environment variable JULIA_PKG_DEVDIR to change where development packages are installed. See the develop docs for more info.

As @crstnbr noted, an alternative is to use the --local option to the pkg> dev command to install a development version of the package in a dev directory within the current project. This could make sense if you're developing your own package MyCode.jl which relies on Example.jl and you need to make a hot fix to Example.jl. Then your Pkg REPL command would look like this:

(MyCode) pkg> dev --local Example

If you would like to make changes to a third-party package and submit those changes as a pull request on Github, there are a few more steps in the process. See this Discourse thread for more details on that process.

Not quite what you're asking for but you can of course always git clone the package to a path of your choice and then dev path/to/the/local/clone/of/the/pkg.

You can even do this from within julia:

using Pkg
Pkg.GitTools.clone("<pkg url>", "<local path>")
Pkg.develop(PackageSpec(path="<local path>"))
Related