Adding package developed in a local folder for use in other environment (for Documenter)

I’ve created a package that I’m currently developing, specifying a path so that it fits into the overall folder structure (and the overall git structure), using:

using PkgTemplates

t = Template(; user="username", dir="path_to_mypackage", julia=v"1.7.1")

Now I wanted to use Documenter so I created the following additonal docs structure inside the package:

- docs
  - src/
  - make.jl
  - Project.toml
- src/
  - ...

My goal would be to then run julia --project=docs docs/make.jl, but I do not know how to properly “add” my package “MyPackage”. Since its not in the usual Julia folder I can not add it to my “docs” environment (when running ] (docs) pkg> add MyPackage) and therefore I can not using MyPackage inside the make.jl.

As far as I understand, running Pkg.develop("MyPackage") would create a copy of my current package in .julia\\dev\\MyPackage. Changes that I do in my local folder would then not be visible there and I could not develop and update the documentation at the same time; so that seems to be no option either.

I’m pretty sure there is a simple fix to this, but I can’t find out how.


$ cd docs
$ julia --project=.
pkg> dev ..

The last step can alternatively be done with Pkg.develop(path = "..").


That works perfect, thanks!

One thing that I do not understand though… My package uses JuMP, with MyPackage.jl looking like:

module MyPackage

import JuMP
# all the stuff


I’ve added JuMP to my documentation environment. When building the docs using julia --project=docs docs/make.jl it fails with ERROR: LoadError: UndefVarError: JuMP not defined unless I manually import JuMP in the make.jl too!?

My make.jl is:

using Documenter
import JuMP             # this line is necessary...
using MyPackage

makedocs(sitename="My Doc")

and my

# MyPackage.jl Documentation