logankilpatrick
logankilpatrick

Reputation: 14561

How to download and setup dependencies for a Julia project that is in development?

I am trying to download and install dependencies for a Julia project that's not in the package registry. It has a manifest and project file. How do I get all of the packages it depends on to download at once using the Julia Package manager?

Upvotes: 10

Views: 3620

Answers (3)

David Sainez
David Sainez

Reputation: 6976

  1. Download the source: git clone https://github.com/RandomUser/Unregistered.jl
  2. Activate the project: pkg> activate Unregistered.jl
  3. Ensure any dependencies are installed: pkg> instantiate

Once the package is set up, you can use the package normally. You can load the package:

julia> using Unregistered

Or even run its test suite:

pkg> test

Upvotes: 8

carstenbauer
carstenbauer

Reputation: 10147

Preparation (optional):

  1. Create a new folder somewhere and cd into it.
  2. Start Julia with julia --project=.

Now the actual downloading/installing:

  1. Develop the project locally: pkg> dev --local https://github.com/RandomUser/Unregistered.jl

This will clone the unregistered project into a local subfolder dev/Unregistered and will install all the required dependencies.

If the unregistered project is a Julia package, you can now simply using Unregistered. If you want to work on Unregistered.jl itself you can pkg> activate dev/Unregistered to work in the project environment.

Upvotes: 1

carstenbauer
carstenbauer

Reputation: 10147

FWIW, here is a "pure" Julia version of what @David Varela suggested.

After substituting <url-to-project> and /some/local/path this "just works" in the REPL or similar:

using Pkg
Pkg.GitTools.clone("<url-to-project>", "/some/local/path")
cd("/some/local/path")
Pkg.activate(".")
Pkg.instantiate()
# Pkg.precompile() # optional

Upvotes: 4

Related Questions