Define package by url and branch in Project.toml

I’m wondering if it’s possible to defined a package in the Project.toml file by its github url and branch.

In my environment I can do pkg> add https://github.com/pathto/MyPackage.jl#mybranch, but only the Manifest.toml gets updated with the relevant package url/branch information, and not the Project.toml. From the Pkg.jl docs I don’t see any indication that this is possible, but I would like to make sure that I haven’t missed anything in the docs (or anything not documented)?

If this isn’t possible, my next question is: what’s the right approach to add dependencies on packages by url/branch. I mean, should we push the Manifest.toml to the git repo? From several threads (e.g. this and this) I understand that this is generally discouraged. Is this particular situation an example were pushing the Manifest.toml is the only solution? The problem I find with that is that I have troubles with the CI if I push the Manifest.toml.

I’ll illustrate the reason for all these question with my real problem.

Deneb.jl dependes on DemoCards.jl to build its docs. I’ve recently open a PR to DemoCards.jl with an update that I would like to bring to Deneb.jl’s docs. Before waiting for the PR to be merged and a version tag created, I would like Deneb.jl to already make use of the proposed update. I attempted this by pushing a Manifest.jl file that points to DemoCards.jl version that i forked to create the PR (see the pushed manifest here). This works well locally (the environment builds correctly and I can produce the desired docs), but makes the Documentation CI action to fail in the dependency installation step.

Any light on this problem would be appreciated.

JuliaLang/Pkg.jl#492 has some discussion.

1 Like

@fredrikekre Thanks for the pointer, it looks like this is a most wanted issue!

There is also a proposed solution on this PR by @quinnj from almost a year ago. But I don’t see any discussion since April this year. Does anyone know what’s the status of that PR? any reason not to push it forward?

BTW, the solution to my problem was fixed by adding Pkg.add(url="https://github.com/brucala/DemoCards.jl", rev="transitiongrid-theme") in the docs CI workflow.

Sounds a bit hackish. Hope the PR mentioned above gets merged sometime.