Usage of subdirectories to store multiple packages in a single repo

Many/most of these questions can probably be answerd by this: Packages in subdirectories are just regular packages. They just happen to live in the same git repo.


Yes they need to be packages on their own with Project.toml, src/Package.jl entrypoint etc. Probably this structure makes the most sense:

$ tree .
.
├── PackageA
│   ├── Project.toml
│   └── src
│       └── PackageA.jl
└── PackageB
    ├── Project.toml
    └── src
        └── PackageB.jl

4 directories, 4 files

or perhaps

$ tree .
.
└── packages
    ├── PackageA
    │   ├── Project.toml
    │   └── src
    │       └── PackageA.jl
    └── PackageB
        ├── Project.toml
        └── src
            └── PackageB.jl

5 directories, 4 files

Not sure what you mean – they are standalone packages. On the repo-level if you want some common tests you can structure it like this maybe:

$ tree .
.
├── docs
│   └── common_docs.html
├── packages
│   ├── PackageA
│   │   ├── Project.toml
│   │   └── src
│   │       └── PackageA.jl
│   └── PackageB
│       ├── Project.toml
│       └── src
│           └── PackageB.jl
└── test
    └── common_tests.jl

7 directories, 6 files

(but Pkg.jl doesn’t understand it so you must organize it yourself).

Since they are standalone package the same mechanism as if they were different repos.

Here is an example: InlineTest: bump version 0.1.0 -> 0.1.1 · JuliaTesting/ReTest.jl@57368e6 · GitHub

If it is registered just like a normal package. If you add by URL you specify the subdirectory after :: add url:/subdirpath

Yes.

5 Likes