conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.22k stars 979 forks source link

[question] Version range smart search available? #12179

Closed JackRenner closed 2 years ago

JackRenner commented 2 years ago

I am looking to use version ranges for several of my development packages to get each of their latest versions, but I want to restrict the version search by the version of their primary shared dependency.

[requires]
shared_package/2.3.4
pkgA/[>=1.0.0]
pkgB/[>=1.0.0]
pkgC/[>=1.0.0]

So if we have pkgA/1.0.0 and pkgA/1.1.0 built with shared_package/2.3.4, but pkgA/1.2.0 built with shared_package/3.0.0, I would like conan's version range resolution to select pkgA/1.1.0.

Is this currently possible, or is there another way to achieve the same result?

memsharded commented 2 years ago

Hi @JackRenner

I am afraid this is not possible. Such "smart" dependency resolution is an algorithm that requires backtracking and is known to be NP-hard. Given that the resolution of every node in the graph requires frequently to download, unzip, install, load and interpret a python or several python files, and evaluate a few methods of that python file, that makes this problem intractable in practice.

It is also true that in practice, users have versioning and continuous integration strategies to control how new versions are managed, typically either being conservative or trying to continuously move forward. In your scenario, different approaches could happen:

JackRenner commented 2 years ago

Dang. I figured that this would be challenging to implement and use practically. I appreciate the response, and everyone's hard work on conan, its a fantastic tool!

memsharded commented 2 years ago

Dang. I figured that this would be challenging to implement and use practically. I appreciate the response, and everyone's hard work on conan, its a fantastic tool!

Thanks for your kind words and following up with feedback on this issue! :)