Pkg checkout in Julia 1.0?

how does one switch to/checkout and switch back/free from stable to the master with the new Pkg?

Use pkg> add and pkg> free (see their docstrings). Example:

(v1) pkg> add Example
 Resolving package versions...
  Updating `~/.julia/environments/v1.1/Project.toml`
  [7876af07] + Example v0.5.1

(v1) pkg> add Example#master
  Updating git-repo `https://github.com/JuliaLang/Example.jl.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.1/Project.toml`
  [7876af07] ↑ Example v0.5.1 ⇒ v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git)

(v1) pkg> free Example
 Resolving package versions...
  Updating `~/.julia/environments/v1.1/Project.toml`
  [7876af07] ↓ Example v0.5.1+ #master (https://github.com/JuliaLang/Example.jl.git) ⇒ v0.5.1
2 Likes

interesting. ‘#’ is usually a comment. thanks. Is there a Pkg.add() version, too?

Pkg REPL mode does not use standard Julia syntax (that’s what the Pkg API is for).

As for versions, use e.g. pkg> add Example@0.2.0 or equivalently pkg> add Example@v0.2.0.

In case you forget the syntax, run pkg> ?add

Also worth noting that unlike the old checkout, the above solutions don’t give you the full git repo and you shouldn’t be editing anything inside those packages. If it’s your intention to do any modifications, do dev MyPackage instead.

2 Likes

but is there also a Pkg.add() version thereof?

What does free do? For example, right now I added add VegaLite#master since the master branch is updated for 0.7/1.0. Eventually this will get tagged and I don’t need to track the master branch. So when that time comes i’ll have to manually run free VegaLite or will it be automatic? And will I need to add again?

AFAIK you need to free, otherwise it will keep tracking #master. But you won’t need to add again.

I would encourage you all to read the manual: https://docs.julialang.org/en/v1/stdlib/Pkg/ . Every question that have been asked here have their answers in there.

Pkg.add(PackageSpec(name="Example", rev="master"))

From the docs:

free: undoes a pin, develop, or stops tracking a repo.

3 Likes

Just in case anyone else is struggling with the same problem and ends up here:

The command to check out a fork of a package (e.g. pull request) seems to be

(v1) pkg> develop [GitHub link]
1 Like