I have installed Metalhead.jl
package via Pkg
and I am using that installation for development. Every time I make a change in the folder, I test behavior of the package in a Jupyter Notebook opened on VS Code. The problem is that, once I have run the following line:
using Metalhead
Rerunning it does not load the Metalhead package again. I have to quit the Notebook, open it again and run that line to see a change in behavior. Is there a way to reload the package without quitting the Notebook?
CodePudding user response:
If you're working on a package locally, make sure to clone it via Pkg
in dev mode:
develop --local Metalhead
This will create a new folder dev/Metalhead
inside your current project folder. You will need to start Julia with julia --project=.
where .
refers to your project folder.
Then you can make changes to your packages and instead of using
use include
to load your local dev package:
include("dev/Metalhead/src/Metalhead.jl")
This will give you a warning like so:
WARNING: replacing module Metalhead.
Main.Metalhead
But after that you can use all the functions inside Metalhead, including your new ones, e.g.:
julia> Metalhead.AlexNet
Main.Metalhead.AlexNet
I tested this by adding a dummy function to Metalhead, but there might be more elegant solution out there.
This video about package development is old, but still you might be able to take some tips from Chris, so I recommend you check it out.