Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia: How to set the package Dev path?

Tags:

julia

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?

like image 671
xiaodai Avatar asked Oct 12 '19 01:10

xiaodai


People also ask

Where are Julia packages saved?

One or more modules can be stored in a package, and these are managed using the git version control system. Most Julia packages, including the official ones, are stored on GitHub, where each Julia package is, by convention, named with a ". jl" suffix.

Where does Julia install packages?

Julia uses Git as a repository for itself and for its package and that the installation has a built-in package manager called pkg. jl.


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.

like image 68
Cameron Bieganek Avatar answered Nov 18 '22 13:11

Cameron Bieganek


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>"))
like image 5
carstenbauer Avatar answered Nov 18 '22 13:11

carstenbauer