4 ms·
Version pinning does not compose. We keep treating things like lock files as if there is only one kind of use for code and it's just madness. Should end-user
by hinkley 6y ago
Version pinning does not compose.
We keep treating things like lock files as if there is only one kind of use for code and it's just madness.
Should end-user applications use pinning? Yes, and aggressively. Should library writers use pinning? Please, no.
- steveklabnik 6y agoI think part of what makes these discussions difficult is that each system uses similar-but-different approaches. For example, in Rust, even if your library has checked in Cargo.lock, it won't be used for resolution of that library. This suggestion of yours is literally coded into Cargo directly. But someone coming from Node may not instantly get that, even if both ecosystems "use semver."
- chrismorgan 6y agoNotwithstanding this (that Cargo.lock doesn’t apply to libraries), you can pin in Cargo.toml by specifying exact dependencies: `foo = "= 1.2.3"` will accept only version 1.2.3.
- steveklabnik 6y agoYeah, this is a good point. I don't know that I've ever noticed it in the wild, but it is possible.
- wiredfool 6y agoI can’t upvote enough. If you’re writing a library or a plug-in that is going to work with different major versions of some containing application, you have to be somewhat flexible in what dependencies you require. You’re going to be coexisting with other plugins and libraries. If you want requests 2.23.0.1, and the other one wants 2.22, and the other one wants 2.24, all to simply do requests.get, madness follows from the people trying to use the library. This leads to either: forking, serial pip installs, or madness. Or all three. Libraries shouldn’t have a preference for tzinfo, or certifi. They certainly shouldn’t have conflicting preferences for them, and the only way that can happen is if the libraries defer to the application for the version of widely used core dependencies. There are exceptions, and generally fall along the lines of libraries that have tightly coupled dependencies, or cases where the specific advanced features are used. I’m thinking here of awscli and boto, but there have been epic disagreements on both between awscli and awsebcli.