Skip to content

Feature Request: multi-package .git repositories #1928

@ma-laforge

Description

@ma-laforge

I am creating this feature request in response to @KristofferC 's comment: #1874 (comment).

Overview

The following describes a workflow I would like to achieve using Julia's Pkg/Registration/CI systems. The intent is to reduce the .git repository clutter, while maintaining the fine-grained package hierarchy we have now. Oh, did I mention I want to do this while simultaneously maintaining the minimal dependency requirements of our "base" packages (i.e. RecipesBase.jl for Plots.jl, or SnoopCompileCore.jl for SnoopCompile.jl).

Ideally, this feature should provide the facilities necessary to make package development, registration, and testing relatively easy.

Multiple packages per repository

To avoid repo-clutter, a Julia repository should be able to store multiple (typically related) packages:

PkgRepo
├── somepkgdir
│   ├── PkgA
│   │   └── Project.toml
│   ├── PkgB
│   │   └── Project.toml
│   └── PkgC
│       └── Project.toml
├── RepoManifest.toml
└── RepoProject.toml

Locating packages

Unless we intend on freely moving packages across .git repositories, UUIDs only really need to be assigned to the repositories themselves. The same goes for the repository version number:

RepoProject.toml

name = "PkgRepo"
uuid = "aa65fe97-06da-5843-b5b1-d5d13cad87d2"
version = "1.7.1"

[packages]
PkgA = "somepkgdir/PkgA"
PkgB = "somepkgdir/PkgB"
PkgC = "somepkgdir/PkgC"

Note that we can place packages anywhere (somepkgdir) to accommodate multi-use repositories (not only pure-julia repos). See mention of "Arrow repository" in #1874 (comment).

As mentioned above, individual packages don't need a UUID - only the repo. The (full) UUID of a package, say PkgA is therefore:

{PkgRepo_UUID}!PkgA #Or something similar

So, using this system, your code can import packages from multi-package repo with the following:

import PkgRepo!PkgA

Note: I decided to introduce ! because (:, .) are already used in import statements, and @ is a bit confusing (PkgRepo@PkgA or PkgA@PkgRepo??)

Registration at the repository level

To simplify the registration process for developers (but not necessarily developers of Pkg.jl, Registrator.jl, ...), only package repositories should be registered directly.

When a new version is registered with JuliaRegistrator, PkgRepo.RepoProject.toml is parsed, then all packages in that repo get registered simultaneously. I guess this will be somewhat taxing on the dependency tree parser because it will have to be run once for each project in that repository.

The advantage of registering julia package repositories instead of individual packages is that developers can more easily add/remove packages as they split up/combine their solution. No need to re-register each individual package, and no need to worry about potential naming collisions because packages are imported through the repository name (PkgRepo!PkgA).

The limitation in this scheme is that versioning is done at the repository level, not the package level (which is kindof what we had at the beginning anyways). I think this is great! It will be much simpler for developers to function with this mindset anyways!

Package development

To keep things simple, I think it is best we triggered the dev command at the repository level, and not the package level:

This is the most natural solution because really, as soon as you clone the repository, you are able to make changes to all packages anyhow. It is also very natural because when you add a feature to your package collection, chances are you will need to add code across multiple, interdependent packages. Let's also not forget that the point of this feature request is so we can collect related packages together in a single repository.

Unit testing

Again, I think the best idea is to keep unit testing at the repository level. Of course, from the point of view of the developer, testing can be broken down into individual packages. That's quite fine and logical. Nonetheless, CI testing gets triggered when we push our changes to Github. Moreover, a single commit in PkgRepo!PkgA might require PkgRepo!PkgB to be re-tested if it depends on PkgRepo!PkgA. It therefore makes sense that CI be configured to perform package testing for the entire repo irrespective of the changes being made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions