Gaussia, here’s a workflow that performs well for my needs.
After adding Revise to your default v1.X
environment, in a ~/.julia/config/startup.jl file, have the following:
using Pkg
if isfile("Project.toml") && isfile("Manifest.toml")
Pkg.activate(".")
end
try
using Revise
catch e
@warn "Error initializing Revise" exception=(e, catch_backtrace())
end
Now, make a package for a project.
cd ~/Documents
julia -e 'using Pkg; Pkg.generate("example")'
cd example
julia -e 'using Pkg; Pkg.activate(".");Pkg.instantiate()'
ls -l
Manifest.toml
Project.toml
src <-- your module lives in this subdirectory
touch playground.jl <-- your project script
ls -l
Manifest.toml
playground.jl
Project.toml
src
ls -l src
example.jl <-- your module
Once this is set up, when julia is launched in the example directory, it should use the example
project as the environment. Any packages added in the session should then be available to the playground.jl script or the example.jl module via a using X
line in those files.
Your default v1.X
environment, launched outside the example directory, should have only a couple packages used everywhere, such as Revise or Infiltrator. Remove other packages added by mistake to that default environment.