ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.24k stars 354 forks source link

should `pin-depends` imply `depends` ? #5795

Open zapashcanon opened 8 months ago

zapashcanon commented 8 months ago

Hi,

I realized that if I have the following owi.opam file:

depends: []
pin-depends: [
  [ "encoding.dev" "git+https://github.com/formalsec/encoding"]
]

Then, running opam install -y ./*.opam --deps-only --with-test would not install encoding.

But if I add it to the depends fields:

depends: [ "encoding" ]
pin-depends: [
  [ "encoding.dev" "git+https://github.com/formalsec/encoding"]
]

Then it would be properly installed with the same command.

I'm wondering if there is a reason why a package being present in pin-depends does not imply it is part of depends ?

Thanks!

kit-ty-kate commented 8 months ago

I'm wondering if there is a reason why a package being present in pin-depends does not imply it is part of depends ?

one reason i can think of out of my head at the moment is: it could be a depopt (optional dependency) instead

kit-ty-kate commented 8 months ago

TODO for us: we could add a lint check to warn users when a pin-depends is not listed in either depends or depopts

zapashcanon commented 8 months ago

Oh indeed, that's a nice idea. In our case, it would have been enough to detect our mistake earlier. :)