Julia module loading
When the code grows to a certain size and you want to separte the common parts.
Assuming we have the file structure for the submodules
Submodules: include code
You could include the little packages as submodules like this
- Best when the submodules are used exclusively for this project.
- Usually you want to
include()all dependent files in the top-most file, just like a table of contents.
usinglines are needed to be executed again when the code in Modx changes.
- Use relative module path when
- There might be recursive
dev --local pkg...
Add local packages and track the file changes in the Julia REPL
Or by the Julia script counterpart
- Best when
Mod2are modified frequently and shared.
- Loaded code is determined by local files instead of package versions.
- The updates are loaded when
usingis invoked, along with precompilation. Revise.jl tracks and updates modified files and you don’t have to restart the Julia process should you make changes.
Hosted from your repo
Make a Git repo for your custom module and publish it to Git service providers, e.g. GitHub / Gitlab.
And then you can:
PkgTemplates.jl is recommended to generate package with unit tests and CI/CD settings.
Nonetheless, it’s just one step away from proper registeration to the general Julia registry to used by more people.
LOAD_PATH (⚠️ outdated)
- The old way before Pkg3 and Julia 1.0, which is not recommended by now.
- No need for
- Local files are tracked instead of package versions.
- VS Code language server could not identify symbols from the custom modules.