Hello everyone,
I’m on a constant quest to find the easiest way to load a module without using include
.
I discovered recently through the use of the DrWatson.jl package that you can do using MyPkg
from its environment even though the package has no uuid defined.
Let’s say we have the following:
# MyPkg/src/MyPkg.jl
module MyPkg
plus_one(x) = x + 1
end
# MyPkg/Project.toml
name = "MyPkg"
Note the absence of the the uuid
field.
In the Pkg repl mode:
(@v1.8) pkg> activate .
(MyPkg) pkg>
In the activated environment I can do now
julia> using MyPkg
julia> MyPkg.plus_one(1.2)
2.2
Even though my Project.toml does not contain any uuid, I can still load MyPkg.
This breaks if MyPkg.jl
is not placed in the src
folder.
This brings me to the following questions:
-
How is this possible? I could not find any explanation of this behaviour in the docs. Could someone point me to the relevant part of the documentation?
-
I had to create the Project.toml file manually in order to not get the uuid. Is there a way to generate such a project.toml file containing only a
name
field for the project and nothing else using the Pkg api?
Thanks in advance
Olivier