Private subpackages

I have a private (unregistered, closed-source) package. Now I would like to split part of that package into a separate subpackage, i.e. a Julia package that lives in a sub-folder of my current main package, but has separate dependencies, tests, version etc.

Can I use the Julia package manager to point to the subpackage, or do I have to treat the sub-package as a regular submodule by include("SubPackage/src/SubPackage.jl"); using .SubPackage? I would prefer to have the convenience of SemVer by using the package manager. Does this require a local registry? If yes, is it possible to put that into the repo of the main package in order to keep the main package self-contained, i.e. all dependencies can be resolved without referring to any extra files outside the main package root folder?

Yes, you can. When adding by URL or path, append a colon and the directory name. If you develop by path you can just provide the path into the subdirectory.

There are some things you can do without but for the full power of the package manager you want your packages to be in a registry.

I wouldn’t exactly recommend it, but it is indeed possible. The technical requirement of a registry is that it contains a Registry.toml at the top of a git repository and some area for the registry data files. With existing tooling the data files are structured in the same way as in the General registry (<package_initial>/<package_name>/*.toml).

The major drawback of doing it this way is that you will get a full copy of your package code in ~/.julia/registries/your_registry, not only the registry information.

Similarly, if you have the main package at the top of the repository and the subpackage in a subdirectory, the main package will contain (an unused) copy of your subpackage.