Pkg can't find the forked and cloned package I'm working on (but julia can via LOAD_PATH)

Hi all,

I’m getting the following error when trying to use Pkg to test a package:

(v1.1) pkg> test SomePackage
ERROR: The following package names could not be resolved:
 * SomePackage (not found in project or manifest)
Please specify by known `name=uuid`.

In order to get to this point, here is what I did:

  1. Forked SomePackage on github
  2. Cloned SomePackage to my local machine using git clone url/to/SomePackage. I did this into a local directory on my machine /home/colin/GithubClones
  3. Added /home/colin/GithubClones to LOAD_PATH in my startup.jl file
  4. Successfully performed using SomePackage and then ran some functions from it
  5. In package environment I tried test package and got the error message above.

So my conclusion (which may be wrong) is that adding /home/colin/GithubClones to LOAD_PATH is sufficient if I just want to use the package, but not sufficient if I want to use Pkg to do things like test the package, or use resolve to fix up any changes in Project.toml and Manifest.toml files.

Any idea what I’m doing wrong here, or what I need to be doing?

BTW, the reason I forked and cloned the package instead of using dev SomePackage is because I’m not a registered committer on the package, and so I figured it would be better to follow the Github fork-and-branch approach to submitting a PR, and I wasn’t quite sure how to do this while simultaneously using dev.

Cheers and thanks,

Colin

I’ve worked it out. For those who are interested:

If you want to use Pkg tools, like test and resolve, the package needs to be part of your overall environment, which isn’t going to happen just by letting Julia know the package is there via LOAD_PATH. The package needs to be added via Pkg using add or dev. I wasn’t really sure how to do this, because I wanted to dev the forked and cloned package I had locally, not the package registered in METADATA. It’s actually super-simple. dev can take a local path as input, so all I needed to do was call dev /home/colin/pathtoSomePackage and I was ready to go.

One point of interest: using Pkg ; Pkg.develop("/home/colin/pathtoSomePackage") did not work. I had to enter the package environment using ], and then dev /home/colin/pathtoSomePackage in order to get things working.

Yea, dev is really great for this, and dev is a much better way to make julia aware of packages than adding to LOAD_PATH.

Yea, if you read the docs it says you need

Pkg.develop(PackageSpec(path = "/home/colin/pathtoSomePackage"))
2 Likes

Ah yes, I just re-read them. I obviously didn’t look closely enough at the examples the first time around.