Looks fine to me! Ofc this is not a package. For faster development, you will benefit greatly to use, i.e. load, Revise.jl in the REPL. If you want something more complicated and streamlined have a look at DrWatson.jl.
I would add that your functions should go in a different file than the scripts that call them. Why? Because it makes calling the functions more convenient, flexible, and efficient. If you put the function definitions in the same file as the script that calls them, then each time you include the script, the functions will have to be recompiled. But If, instead, you execute
using Revise
followed by
includet("my_functions.jl")
(Notice the “t” at the end of the includet function), where “my_functions.jl” contains all your function definitions, then any edits you make to the function definitions are instantly and automatically sensed by Julia so that you are ready to run (or re-run) any scripts that depend on them. Note that the includet function only need be run once per Julia session in that project.
But I found that in this way I could no longer click to choose the environment in the VS Code’s status bar successfully. It tells “You opened a Julia package that is not part of your current environment. Do you want to activate a different environment?”
But must I execute using Revise strictly after activating the project? I have added using Revise to ~/.julia/config/startup.jl to make sure Revise to be loaded on the Julia REPL startup. Maybe at that timepoint, the activated environment is still @v1.x.
From what I can tell, your proposed workflow should not require an environment change. When you open myProject folder in VSCode, it should automatically switch to the environment myProject (defined by the project.toml file there). Then all your .jl files inside the myProject folder can also work with that environment. Check that you don’t have an extra project.toml somewhere in the structure and that pwd() in the REPL returns the myProject folder.
If you instead want to call your myProject functions from .jl files that live outside of that folder, then you will want to make myProject a package. (I believe all that would require is making a file myProject/src/myProject.jl. I don’t think you need to deal with git and Github.) Then you would make a new environment where the external .jl files live, and use dev "path/to/myProject" in that external environment.
myProject.jl
module myProject
using PackageA, PackageB
export functionX, functionY
include("FileWithFunctionDefinitions.jl")
end
You might find my comment here, and the two comments below useful. It assumes that you have already created a project folder containing some main .jl file, which you have opened in VScode.
All of my projects start with these lines of code. Note that it does not matter if you start a project for the first time, or if you resume to it.