-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support [sources] section in Project.toml #3263
Conversation
More details laid out in #492, but essentially: * Support a `[sources]` section in Project.toml for specifying relative path and repo locations for dependencies * Support a `parent = "ParentName"` entry in subpackage Project.toml in monorepos to allow inheriting `[sources]`
@KristofferC, @fredrikekre , or @StefanKarpinski: would one (or more) of you have time to review here? Or if you don't have any objections, I'll plan on merging in the next day or two? I expect there to be a little bit of follow up here, but I've locally moved 2 large monorepo projects over to use this and everything seems to be working smoothly (in addition to the tests added here). |
I haven't looked at it in detail, but I don't like the parent thing (seems more useful for something like #1233). Can you elaborate on what a source means? I assume it is just a backup if Pkg can't find it anywhere else? |
Yes, it's essentially part of what would be required for #1233 and was coincidentally proposed by @KristofferC as he and I discussed the problems of a monorepo. Being able to specify a parent "project name" by a subproject allows the subproject to "inherit" from the parent. In the limited scope of this PR, that means inheriting
Yeah, source basically corresponds to the source information we have in Manifest entries, either a local path for "devved" packages, or a repo url + rev (and optionally subdir) for "checked out" packages. This just allows us to encode this information in the Project.toml instead of only having that information available in a Manifest.toml, which is helpful for non-public packages or applications where you have a mix of public or monorepo-style subproject dependencies. In spirit, it seems "right" to me because it allows specifying the information needed to instantiate a project without needing a checked-in Mainfest necessarily (Manifests are obviously still useful for exact reproduction of an env), but I think it's useful because from the Project.toml, we can clearly identify that a certain Project has non-traditional dependencies (checked out or otherwise). |
I think this PR could use more discussion about what the problem is and what it tries to solve over just describing the functionality it implements. That makes it easier to discuss if the particular feature here is the best way of solving the actual problem. For a bit more background, @quinnj and I discussed various solutions to the issue where you have a monorepo that contains many packages and activate one of those packages and want to do some development. The annoying part is that you have to One of my (now slightly modified) suggestions to this issue (which I personally liked) was to be able to give a set of folders (that contains locally developed packages) that could be used as a kind of implicit registry. Right now, if you do
That would allow solving the monorepo problem by just adding the monorepo to the set of implicit registries without changing anything else. |
Thanks, yes, I should have provided a bit more context to what was motivating the changes here. Also for context, I basically provided an updated implementation of the now-stale PR here, which seemed to have broad support and consensus that it was a good idea. I.e. allowing the With that in mind, the real net-new functionality proposed here that hasn't really been discussed/agreed upon is the @KristofferC, do you feel like you have specific concerns with the |
@KristofferC, following some more on latter part of your response: how exactly do you imagine this "implicit registry" to work? Like, where do we specify it? In a monorepo Project.toml? Or is it just something I have to do manually via I can see the appeal of your hypothetical walk-though, I'm just not clear on how the implementation looks. And as another push for I'm open to alternative solutions here; I just want to do a slight push-back since the old |
The part I'm confused about here is the project file in the monorepo root. Does the monorepo itself have to be a project/package for this scheme to work? That seems weird to me; while I can see a case where there's an umbrella package that binds a bunch of packages in a monorepo together, it seems like it would also be common for the root to just be a directory. Are you just using the root having a |
In the two cases I have use for this, they are application projects, so yes, the root is a full-fledged Project.toml for the application and within that application/monorepo directory, there are internal packages at a specific subdirectory. I can see why the overall PR here doesn't make as much sense if we're not considering an application monorepo. The alternative use of a monorepo (correct me if I'm misunderstanding here), would be if we had a local (or network-accessible) directory that had a bunch of unregistered/private packages, and then N application-like projects that all wanted to reference those private packages in the shared directory? In that case, I think this solution also is in the right direction, where individual application Project.toml's could use the
I feel like that wouldn't be too hard of a follow up PR to allow that use-case. |
Ok, to merge? I'm eager to push forward on this. |
I really don't feel like this design has reached a consensus. Would be good to have a call with the interested parties to hash it out. At least you, me and @KristofferC, I'd say and anyone else who wants to join. |
What is the status of this? It looks like there hasn't been activity on this PR since early January. This seems to be the most desired feature in Pkg.jl: https://github.com/JuliaLang/Pkg.jl/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+ so would be awesome to have. |
If there is no consensus on the The underlying issue #492 has been open for 5 years and is the biggest pain point in |
This is now the most-upvoted 1.* feature request in the entire JuliaLang organization, by quite a margin too:
Please 🙏🙏🙏 |
@StefanKarpinski, regarding this:
What was the outcome of this call? Is this PR good as-is or was an alternative discussed? |
Yeah, sorry for the slow responses here. We did a call and essentially found that there was an alternative route for monorepo support that was already mostly supported by Base loading code and only needed a minor enhancement in Pkg (the solution is that Project.toml files are allowed to specify a specific manifest file to use, with multiple subprojects being able to "share" a single root-level manifest). I still agree that having a |
To add more specific details, the alternative approach that Jacob describes above is to set the For example, our codebase is split into several sub-packages under the name = "RAI_Common"
uuid = "<uuid>"
authors = ["<authors>"]
manifest = "../../Manifest.toml"
version = "0.1.0" and by pointing to the root-level manifest, any pkg changes to this sub-package get reflected in the root level manifest. This approach seems to be working for us for now. Thanks again to @quinnj, @StefanKarpinski and @fredrikekre for getting this working for us. |
That solves the problem for monorepos, but it does not solve the problem that working on multiple interdependent unregistered packages is borderline impossible. The simplest example is two unregistered packages So I would emphasize that having |
Just a short drive by comment, I do think this is still useful and we should discuss more thoroughly the use case and pain points different people have and come up with something that hopefully works to improve the situation. |
Something like this would be very useful for us -- we have a (growing) Julia monorepo, and are feeling a lot of the same pains as already discussed here. @quinnj; will this always install local packages as "develop" dependencies? Or will it take a copy of the files and put under Looking outside of Julia, poetry (see On the 'parent' logic, does this imply that directories above the packages in the monorepo are themselves packages? For example, we have a repository roughly like so:
where each subdirectory of In this case neither
Ah that's good to know! I've played around with it a bit, but unfortunately it doesn't seem to work nicely with our setup (especially the "projects"). Or is it requiring features that aren't available in Julia 1.10? |
@tpgillam, in case it's helpful, the RAI mono repo has a single top-level package that depends on the packages in
and then
|
Thanks @nickrobinson251 ! This is very useful. I've played around a bit more and also discovered the following:
2 above is very nice, and this was the thing I (incorrectly) had thought wouldn't work. |
Does anybody know if there's a package for emulating this type of behavior? It's frustrating to work around this when editing co-dependent packages not in the same monorepo. |
Let's continue the |
More details laid out in #492, but essentially:
[sources]
section in Project.toml for specifying relative path and repo locations for dependenciesparent = "ParentName"
entry in subpackage Project.toml in monorepos to allow inheriting[sources]