A package for Julia that provides easy file-referencing for project-oriented workflows.
You can install the package using the Julia package manager:
]add ProjectRoot
Alternatively, you can also install the latest development version of the package from the source code on GitHub by calling
using Pkg
Pkg.add(url = "https://github.com/jolars/ProjectRoot.jl")
The package provides a single macro, @projectroot
, that can be used to reference files in your project. The idea is to in some file A.jl
be able to reference another file B.jl
somewhere else in your project without having to care where file A.jl
is or need to update the reference if you move A.jl
somewhere else.
Take this example project:
MyProject
├── scripts
│ └── A.jl
├── src
│ └── B.jl
└── Project.toml
If you want to include B.jl
from A.jl
, all you need to do is this:
include(@projectroot("src", "B.jl"))
Now, calling A.jl
from anywhere in your project will work as expected. And if you move A.jl
to another folder, say scripts/subfolder
, the import will still work.
@projectroot
also handles calling lines from A.jl
through the REPL, by fetching the current working directory.
When writing commit messages, please use the conventional commits format.
ProjectRoot uses semantic versioning.