Installing from a subdirectory of Github

I have a Julia package on GitHub for which I’d like to include installation instructions. However, the Julia code is in a subdirectory of the repo as this repo includes both a Julia and R version of the code.

I can’t figure out how remotely install the package from the subdirectory. My first pass was

Pkg.add("https://github.com/pistacliffcho/LatentChannelNetworks/tree/master/Julia/LatentChannelNetworks")

This leads to a 404 error. Is there a way to specify a subdirectory of a repo?

EDIT: I have split up the R and Julia repos so the link above currently is broken.

I don’t have a solution for your problem, but as a workaround, you could git clone the repository (in the shell) and then in Julia pkg> add or pkg> dev the relevant path.

1 Like

Go here and read using someone elses project:
https://julialang.github.io/Pkg.jl/v1/environments/#Using-someone-else’s-project-1
download and clone the project.
In Julia then:

cd("clonePath")
]activate .
]instantiate

Also try this it may work:

Pkg.clone("https://github.com/pistacliffcho/LatentChannelNetworks/tree/master/Julia/LatentChannelNetworks")
You can include a package name as the second argument.
Pkg.clone("https://github.com/pistacliffcho/LatentChannelNetworks/tree/master/Julia/LatentChannelNetworks","packageName")

2 Likes

Thanks for the suggestions.

I think best practices is going to be split up the repo into an R and Julia implementation. I think it’s a bit sub-optimal to have a user clone a bunch of code they don’t want (i.e. R version) and then muck around with a subdirectory of the repo, rather than just call Pkg.add("blahblah").