Easiest way to pkg add a pull request?

What is the fastest way to ] add a pull request of a package? For example, if someone has contributed a fix to a package that I want to quickly test out, but that has not yet been merged.

I typically ] dev --local the package and then use GitHubs gh tool to checkout the pr.

I was hoping for something within pkg

pkg> add ${URL}#${BRANCH}.

4 Likes

On a funny side-note, I recently saw

run: julia --color=yes --project -e 'using Pkg; Pkg.instantiate();
    using Foo#master; Foo.build()'

in a GitHub Action. This code looks valid if you don’t pay much attention and it will run in an Action, but it does not call Foo.build :joy:

(This is not an issue or whatever. The pkg API is great. It’s just funny.)

Yes I know how to pull a branch, but that isn’t necessarily the same as a pull request, yea?

Well, I guess it is. The PR is a branch at a forked repo.

2 Likes

Maybe Fredrik knows an even better way, but you can copy the link from the top of the PR and modify it slightly to pass to Pkg. For example, Update WebServer.jl by Moelf · Pull Request #1933 · fonsp/Pluto.jl · GitHub has

If you copy the link from “Moelf:patch-4”, you get https://github.com/Moelf/Pluto.jl/tree/patch-4.

Now, replacing /tree/ by # will work in the package manager:

pkg> add https://github.com/Moelf/Pluto.jl#patch-4

This method works for forks and for PRs from within the original repo.

2 Likes

This question was just borne out of a silly misunderstanding. I was worried about the PR and the branch it is based on becoming out of sync, but that can’t really happen. I guess I just don’t use PRs enough to know how they work — I commit to main :laughing: YOLO

1 Like

i was having a hard time figuring out the branch name for a github pull request, so i used the commit hash instead. like this:

add https://github.com/JuliaLang/PackageCompiler.jl#153c30f4d191bb54ae9afa6483c69c9842774484

Part of the issue is that commit has no branch at that repository. It is located at @sloede 's fork at https://github.com/sloede/PackageCompiler.jl/tree/msl/bundle-libexec

So the command would have been the following.

] add https://github.com/sloede/PackageCompiler.jl#msl/bundle-libexec

You can see this information at the top of the pull request: