Can someone help me figure out how to arrange a package with the structure as in ITensors.jl?

I want to split plotting functionality (which depends on Plots or Makie) from my main package to reduce loading time. I notice that ITensors.jl does the exact thing I want to do. But I have difficulty on how it works. For example,

  • as the subpacakges are in the same github repo, how can I register each of them?
  • Why there is an ITensorVisualizationCore module within the main package ITensor?


TLDR: @JuliaRegistrator register subdir=path/to/my/package

Btw, instead of using subpackages or Requires.jl there might be better support for optional/weak dependencies in the (soon?) future, see e.g. Support in code loading and precompilation for weak dependencies by KristofferC · Pull Request #47040 · JuliaLang/julia · GitHub


As for ITensorsVisualizationBase, I would think that it just hold common code that is shared among the different plotting backend packages.

I am not confused with ITensorsVisualizationBase, but ITensorVisualizationCore, which resides in ITensors/src/ITensorVisualizationCore. Note that ITensorsVisualizationBase is a subpackage instead of a sub module inside ITensors (it locates at ITensors/ITensorsVisualizationBase)

My bad. Don’t what this module is for exactly. Someone else should be able to comment on that.