Pkg.test() for cloned package


#1

My Julia installation includes a registered package X and, in order to make changes to X, I also cloned Master of the package to a folder outside the Julia installation (i.e. Dropbox) and branched from there. Until now, I loaded the package by include("Path to X"). But of course this can be tedious as I have to append everything by X.function.

  1. Is there a way to use using with a path to the module so that it’s not the regularly installed version that is loaded but my local version?

  2. Is there a way to run the tests of the modified package with Pkg.test()?

It might also be that my workflow doesn’t make sense at all. Then also please let me know.

Thanks for your help, Benjamin


#2

Julia packages are just Git repositories. Just make a new branch in the local repository, and it will be the one that using pulls in.


#3

Thanks Chris. The reason I didn’t do that is that I would like to work on the package from different computers, that’s why I cloned it on Dropbox.


#4

Fork the repository, and push the local branch to your fork. Then on any other computer, add this fork to your remotes and just check out that branch.

If you’re unfamiliar with Git, I’d say check out GitKraken. It’s a GUI (nice visuals) and, if you’re new to this, what I said will probably make much more sense when you “see it”.


#5

Thanks again, this is very helpful. I’m still a Git beginner but have been playing with GitKraken for a couple of weeks (actually after seeing you recommending it in another thread). What I actually did until now is

  1. Fork the repository
  2. Clone it to Dropbox
  3. Make changes and push them to my fork
  4. Open a pull request at the original package repository

The only problem with your proposal that I see is that once I have a pull request open, everything I push to my fork automatically ends up at the original repository. But I might want to work on it before updating the pull request. Would you solve that with multiple branches? I just fear that it gets messy quickly and I’m very good at creating a mess with Git.


#6

I would go further and say this is supposed to be solved by branching. I think I should make a video on Julia development practices. It’ll probably help a lot of people get started.


#7

Definitely :slight_smile: