Pkg - cloning from unregistered package, not updating

pkg

#1

I’m trying to use an unregistered package and obtaining it from the GitHub repository by Pkg.clone(). However, it doesn’t appear to recognize that the repository has changed, and even when I delete the local copy in \.julia\dev, it restores the old repository copy from somewhere. What am I supposed to do?


#2

Probably https://github.com/JuliaLang/Pkg.jl/issues/465. Note that you should not use Pkg.clone anymore, use either Pkg.develop or Pkg.add, whatever suits you best in this situation.

You can just git pull manually, or clean out the stale clone in .julia/clones.


#3

Thanks. Pkg.add and Pkg.develop doesn’t work for unregistered repositories though (“not a valid package name”).


#4

Thanks. Pkg.add and Pkg.develop doesn’t work for unregistered repositories though (“not a valid package name”).

They do but maybe you are giving wrong input?


#5
julia> Pkg.add("https://github.com/BioTurboNick/LocalizationMicroscopy.jl")
ERROR: https://github.com/BioTurboNick/LocalizationMicroscopy.jl is not a valid packagename

shrugs

Looking back at the documentation, using the Pkg console’s “add” command seems to work.


#6

Did you read the docs?


#7

Nope. Why does the add command just work but the add function requires wrapping the URL in another object?


#8

To avoid ambiguities about what the argument means in a possibly non-interactive environment.


#9

How common are such ambiguities? Seems like an extremely common usage–grabbing from a local or remote repository’s master branch–should not require unusual effort on the part of the user.


#10

Use the REPL mode if you want convenience.

add url#branch

couldn’t be easier?


#11

Can I do that from within a script? If not, why not?


#12

You can use pkg"add url#branch" if you want to. The API is going to be more stable in terms of compatibility whereas the REPL syntax may change because it is interactive.


#13

You can,

using Pkg
pkg" add url#branch"

but the API interface is recommended for non-interactive use.