nim-lang / nimble

Package manager for the Nim programming language.
Other
1.25k stars 188 forks source link

Conflicting dependency resolution #1162

Open diegomrsantos opened 10 months ago

diegomrsantos commented 10 months ago

Consider the following nimble files

Project A:

version = "1.1.0"

requires "B >= 0.1.4", "C >= 0.0.5 & <= 0.1.0"

Project B:

version = "0.1.4"

requires "C"

Also consider Project C has versions 0.1.0 and 0.2.1 available.

If nimble install A is run, it fails with Error: Cannot satisfy the dependency on C 0.1.0 and C 0.2.1. The version 0.2.1 is installed first for B and later 0.1.0 for A.

Is it expected? When no version is specified, does it mean any version? If so, why hasn't only C 0.1.0 been installed, what would satisfy both A and B requirements?

xTrayambak commented 10 months ago

That's a fairly complicated problem right there. What should the behaviour be? I believe it's fine as it is right now, it's how most languages' package managers handle it.

diegomrsantos commented 10 months ago

I believe installing onlyC 0.1.0 would satisfy both project A and B constraints on C version.

diegomrsantos commented 10 months ago

It seems Nimble is satisfying the dependencies' version constraints (and their transitive dependencies) greedily and locally, instead of globally, considering the whole set of constraints.

xTrayambak commented 10 months ago

I'm fairly sure that's a bug. Nimble will choose any version it can find if none is explicitly provided.