Workflow for local package testing

Hi,

I am currently developping a package, and in the same time making tests with it on a separate juno project (so I have two atom windows open : one for the package and hte other one the the projects where i test the functionality).

Currently, the testing project depends on the github verison of the package, so to test my changes to the package code, I commit them, push them to github, and then do a ] update in the other juno window.

This is highly ineficcient, and I am sure there is a better way. How can i tell my testing project to instead use the local version of the package ? I have Revise.jl setted up so i guess that changing the package files will automatically result into changes in my testing REPL if i manage to setup the dependency to the local package correctly.

2 Likes

Install the package with Pkg.develop (pkg> develop) instead of Pkg.add, see 3. Managing Packages · Pkg.jl.

1 Like

So in the current stage of my project, i should remove the package and install it via Pkg.develop ?

Yes, but you don’t have to remove it since Pkg.develop will overwrite it. For example in the test project:

(test-project) pkg> develop /path/to/local/development/directory
1 Like

Hum… It did not work. I guess that the problem is that the name of the local folder is not the name of the package.

Define “not work”? It doesn’t matter what the folder is called.

Ok now, when running ] status, it links to the local folder, wich is perfect. However, when changing things is the local repo, the REPl should be affected since i have Revise running. or am i fooling myself ?

Edit: On the doc you sent me, is said " The dev command fetches a full clone of the package to ~/.julia/dev/ (the path can be changed by setting the environment variable JULIA_PKG_DEVDIR ). When importing Example julia will now import it from ~/.julia/dev/Example and whatever local changes have been made to the files in that path are consequently reflected in the code loaded. When we used add we said that we tracked the package repository, we here say that we track the path itself. Note the package manager will never touch any of the files at a tracked path. It is therefore up to you to pull updates, change branches etc. If we try to dev a package at some branch that already exists at ~/.julia/dev/ the package manager we will simply use the existing path. For example:"

Therefore, i should developp the package that is in ~/.julia/dev and not the repo i have (somewhere else) on my computer ? Should i work directly in this folder when making changes to a package / developping a package ?

No that should work (and does for me).

Is your local repo stored in .julia/dev (i.e JULIA_PKG_DEVDIR folder ) or somewhere else ?

1 Like

dev also works for already existing local paths, and no copy to ~/.julia/dev will be made:

(@v1.5) pkg> help dev
  [dev|develop] [--shared|--local] pkg[=uuid] ...

  Make a package available for development. If pkg is an existing local path,
  that path will be recorded in the manifest and used. [...]

In the testing project, however, you need to restart the session to let Revise pick up the change in dependency. Did you try restarting?

2 Likes

Aaaaand now it works. Thanks a lot !!

1 Like