-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Allow specifying why a dep is using override #14082
Comments
I believe we should explore this indeed. My suggestion is simply to say:
Then we can:
I am not sure if |
It doesn't read very well, yeah. If we use |
I like override_for: [foo: "~> 1.0", bar: "~> 1.0"] If an atom is received, it could just be seen as Which would also support override_for: [:foo, bar: "~> 1.0"] |
If this is something that seems reasonable to do, I'm happy to take a stab at it. I took a brief look at doing this a few weeks ago, and ultimately the way that override works currently doesn't really help much on this endeavor as its like a "if there are any conflicts, ignore them" check as opposed to happening in the middle of dependency resolution. |
If we're already doing that, I think the items in the Other common use cases for overrides besides the version are pulling in temporary forks that have a bugfix applied via So something like I'm however not sure if that is required. This should also be enough: [
{:ecto_sql, "~> 3.12", override_for: [:db_connection]},
{:db_connection, github: "org/project", branch: "my-fix-branch"}
] |
@zachdaniel I don't understand why we need the version in the @maennchen I believe you have the deps in the example inverted. You'd override |
The idea there is that typically when overriding a dependency you have done some kind of research/checking that it is in fact fine to do so. My example was bad, using
I want to be able to specify that version because there is no guarantee that If its just If I instead just put If we use my proposal, we get the best of both worlds! With The
|
I am not sure we can reasonably change the dependency resolution algorithm to consider that. It is already a complex piece of code, with high runtime complexity, and it seems you are introducing conditional resolution. The resolution should resolve based on the requirements you have explicitly written for |
It is also worth adding that it adds complexity to users too. Imagine you are trying |
The resolved version would still have to match your explicit requirement of Fair enough though. I think it does still leave some room for the class of problems we're trying to alleviate here, but complexity for the user and of the implementation are good reasons. Your call of course :) We could also add it later, since it would be an extension to just the list of atoms syntax, so the first steps can be the same regardless. |
My proposal is simpler and doesn't require changing the resolution algorithm. If you specify |
I’m suggesting that this is built into the mix dependency resolver. Right now the following happens all the time:
foo
to my app. I already havebar
andbaz
.foo
depends on a newer version ofbar
.bar
becausebaz
depends on it.baz
andfoo
usebar
, and confirm that its fine to just override.{:bar, "~> ...", override: true}
buzz
to the app, which also depends on an old version ofbar
.bar
for the sake ofbuzz
as well.foo
releases an update that depends on more stuff from the old version ofbar
.foo
, so we update it and have bugs.If instead of
override: true
, I could say:which would say “this override only overrides the dependency that
foo
at exactly versionx.x.x
has onbar
”, then we are protected from any of those accidental changes.Adding
buzz
would produce an appropriate dependency conflict warning, solving Problem 1. We can then go look at the code/docs and decide if we want to override thebar
dependency for that version ofbuzz
as well.foo
won’t appear to be automatically upgradeable, solving Problem 2.Originally posted by @zachdaniel in #14080 (comment)
The text was updated successfully, but these errors were encountered: