Yes. The export Utils
inside ARMCortexM4Model.jl
only exports the name Utils
, but does not export all the names Utils
it self would export.
Hence, when you write using ARMCortexM4Model
you can then use Utils.greet()
instead of ARMCortexM4Model.Utils.greet()
. If you also add export greet
inside Utils.jl
then you could write
julia> using ARMCortexM4Model
julia> using Utils
julia> greet()
Yes and no: A package (as generated by running Pkg.generate("MyPackage")
) defined as a folder with a name MyProject
containing a Project.toml
file referring to MyProject
(and optionally a Manifest.toml
) and then a src/MyProject.jl
file. Let’s call this a toplevel package, although it really is an environment
(or project
), I think, because it tracks all the dependencies used in it and it happens so that one if it is also called MyProject
. Think of a project
like a virtualenv
in python, if you happen to know that …
There are then two ways to add more modules:
- Recommended: Add submodules to
MyProject
as I did it above, which you can optionally reexport
. See also the@reexport
macro fromReexport.jl
. - Add another package with
Pkg.generate("MyPackage/Utils")
. You must then tell your toplevel package todevelop
this package, e.g. runPkg.develop(path="./Utils")
.
The dev
is needed so that Revise.jl
can track its code. The other alternative is to add
a package, but for that to work the package needs to be git
repository. The way of adding another module through dev
is really only meant for local development of packages and its dependencies and/or mono repos like Makie where they develop multiple packages inside one toplevel package.
In case you haven’t discovered it yet, here is a link to the docs of Pkg
which talks packages, environments
a bit more: 1. Introduction · Pkg.jl
I also must admit I am not a big fan of this kind of project organization and I feel like I am seeing this question being asked way too often. Perhaps this is an indication that things could be simplified or made more user friendly, but then I did not think how …
Sorry, didn’t understand the question.