-
Notifications
You must be signed in to change notification settings - Fork 981
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
[question] Many conan packages in one code repository #17194
Comments
Hi @mmmfarrell Thanks for your question. I'd like to start first saying that unfortunately there are no silver bullets. All approaches have pros and cons, and the mono-repo like approach has some advantages, but it also has its own challenges.
This would be what we call the problem of CI at scale. Something actually a bit beyond of what a package manager is, but due to the demand, Conan 2 incorporated some better tools for this. And the good news is that we are finalizing the first step of a new "CI tutorial" that might help with this. Please check conan-io/docs#3799, even if it is still a PR, it might be good if you can read it. About the workspace feature, we have already resumed work on it. Our goal is to have it released (maybe not fully complete, but at least the core functionality) before the end of the year.
This would mean the mono-repo approach, which is essence is a bit opposed to the package-based development paradigm. If you put everything in a mono-repo, then it would be great to learn and understand what are the pains or problems that you would be trying to solve using a package manager. |
Thanks @memsharded I really appreciate the quick response and link to the docs PR, I'll read through it today and post any questions/comments to the PR directly. Agreed that my question is mostly about development and CI at scale and not necessarily in scope for a package manager, but definitely helpful when example end-to-end workflows are documented to help out others that will need to implement similar workflows. I'm glad to see conan is getting more opinionated (or at least documented) in these areas.
This is a great point and something I should have called out in my original post. For this mono-repo approach, I also believe the "right answer" is to drop all of the subpackages and instead only ship the entirety of the mono-repo as a single conan package. However, given our current division into N repos + packages, build times would be too long if simply pulling them all together (a different problem to solve) and downstream users are used to only pulling in their N, small conan package dependencies instead of one large conan dependency. I am also trying to minimally disrupt current workflows. So in the mono-repo, conan would effectively be used as a build cache locally and to provide granular packages for downstream users to depend on. Obviously not what conan was designed for, but meant to provide an incremental move towards a more traditional mono-repo set up. |
Thanks for your feedback. That makes sense, it is a valid aim and problem to solve. Indeed the workspace feature can help with this, but there is still some large challenges regarding the build system, I guess that you are using or planning to use CMake? Because it has no way of representing simultaneously a single project build tree and using That means that making Conan act as a build cache for local development within a mono-repo is not possible, even with a fully finalized So probably I'd try to move somehow with the following guidelines:
I'll annotate this ticket also to let you know when the workspace feature starts to be released. |
@memsharded very helpful feedback!
I should dive into the details to understand better, but how does conan editable mode work? Is it not effectively doing this? The prototype monorepo I've created to date has build scripts that look at which package you're trying to build and which packages have changes since their version in the conan.lock file (cached build), then sets the necessary packages into conan editable mode based on the build graph. This has been working pretty well locally, so curious how this is different than what you describe. |
Conan But the "consumer" code would still be using
Interesting. That sounds good, and I think this is definitely within the scope of the new |
My previous company resorted to monorepo as well, but that was waaay before I introduced Conan ni there - so there we mostly were using it for 3rdparty deps, and then relying on regular CMake calls. The trick is that we use versions only for said topmost products, and everything else uses Also, just to clarify - do you intend to eventually start releasing actual Conan packages? Or just use Conan as a convenience tool to get binaries in one place? Asking since in both of my cases there was never a point for us to do that, so your workflows might differ. In the old place, the final product was just a hardware running our middleware. In the current place, we ship the |
@Artalus thank you for sharing!
Have you tried using Based on what you described, it sounds like the transitive packages are never pushed to / pulled from the conan cache. Is that accurate? Otherwise how do you prevent the ground from moving under a developer when someone merges new changes, a new
At the moment, I do need to release and maintain versions for the transitive dependencies. I'm not too nervous about maintaining versions b/c we want to maintain versions together in that we care about sets of all of the dependencies that are compatible and tested against one another. So I still think we'd only require N branches (not N * M for each package). But I definitely agree that versioning the transitive packages is the tricky part. Ideally every change is a version bump, or a new
We will be releasing the conan packages for internal ingestion by other groups/teams across the company. To get to the final products, there are additional layers that get the dependencies from the conan packages and then either repackage the software libraries and tools for external use or build / deploy debians to run on hardware. |
One of the points of the
Recall that there is now the |
What is your question?
Currently our company uses 1 repo per conan package. However, this has led to a lot of pain in a several scenarios including: developing a change across several packages, testing a change in downstream packages, and integrating changes downstream. We believe many of our pain points would be resolved by putting many of our conan packages into a single repo. We'd then build out local develop scripts and CI scripts to allow for developers to quickly make changes across many packages and build and test them.
Now this sounds a lot like the intention of the Conan 1 workspace tool, so maybe your answer will be "wait for conan2 workspace". Is there a development / release timeline for workspace in conan2?
But more generally, has anyone attempted building out such a monorepo and all of the scripting required for local development and for CI? If so, any lessons learned that I should be aware of?
I'm early on in the prototyping phase and am happy with a lot of how its shaping up, but running into a few issues around ensuring that multiple developers can submit and merge PRs in parallel for multiple changes in the same conan package. One specific issue is that if packages depend on specific versions of the other packages from the same repo, this would lead to a linear merge queue due to merge conflicts caused by version bumps every time someone edits anything in a package. The alternative seems to be all packages depend on
latest
of other packages in the same repo. However, this necessitates usage of lockfiles to prevent the ground from shifting under a develop when a new PR merges and therefore a newlatest
is pushed to the conan remote. Lockfiles, however, seem to lead to a linear merge queue due to merge conflicts caused by changes every time two developers edit the same package (essentially the same problem as depending on version numbers).My goal is to get to a monorepo composed of N conan packages, where multiple developers can be developing and merging PRs for the same package(s) at the same time. Any insights to help me get here would be appreciated!
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: