-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Provide resolution hints in case of possible local name conflicts #7505
Conversation
4283b10
to
8c7bc4f
Compare
/// | ||
/// This shouldn't usually happen, but it could be the symptom of a naming | ||
/// conflict with a transitive dependency existing on the index. | ||
fn local_cycle_hint( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this heuristic doesn't work for the invocation in the original report (I tested by dropping the pin from your test). Maybe this would be helped by transforming the tree in as tracked by #7524 but I'm not sure. It looks like it might just be a bug because the tree does still contain a cycle with the same structure.
Have you used the UV_INTERNAL__SHOW_DERIVATION_TREE=1
utility? It can be helpful to display the tree in it's raw form.
Without a version pin:
Resolver derivation tree after reduction
dagster==0.0.0 depends on dagster-webserver*
dagster-webserver==1.8.7 depends on dagster==1.8.7
... an enumeration of all the versions follows
With a version pin:
Resolver derivation tree before reduction
root==0a0.dev0 depends on dagster*
dagster==0.0.0 depends on dagster-webserver==1.6.13
dagster-webserver==1.6.13 depends on dagster==1.6.13
no versions of dagster<0.0.0 | >0.0.0
Resolver derivation tree after reduction
dagster==0.0.0 depends on dagster-webserver==1.6.13
dagster-webserver==1.6.13 depends on dagster==1.6.13
On a separate note, it's pretty hard to understand what this heuristic is doing. I know you plan to do some polish on it, and it's not your fault that the data structure is complicated, but I can't review it without some additional context on the idea.
This enhances the hints generator in the resolver with some heuristic to detect and warn in case of failures due version mismatched on a local package. Those may be the symptom of name conflict/shadowing with a transitive dependency.
842f039
to
0defe6e
Compare
I took a look at this quick and I think the detection for the case we care about is complicated than it needs to be. I took a swing at a simpler heuristic in 9bf7a70. There, we just check if there's a non-workspace member that depends on a workspace member; I think this should only occur if the workspace member is shadowing a remote package (though I'm not 100% certain). Since this is just a hint that happens when resolution fails, I think we can risk false positives here. I'd still like to add some tests for workspace members that depend on each other — it seems like a bit of a pain to construct a resolution failure with the proper shape though. Curious for your thoughts. |
0defe6e
to
eb6bffd
Compare
Thanks for taking the time for a deeper look into the tree logic.
Recapping, we came up with several heuristics:
Point 4 should effectively be a subset of point 3, as one of the necessary conditions in the more complex check is that "there exists a failed dependency toward a local package". I think this is also a sufficient condition, so I agree that your code above is an equivalent but simpler check, and I believe it should have a similar amount of false positive. Overall, for the task at hand I prefer yours over my version. I massaged it into this PR and fixed the tests, CI is fine with both the previous and new version, as you prefer.
The testing space around this is quite large, which scenario do you want to check? The same as existing tests but in a sub-package, or a cycle not involving an external package? |
Yeah I think we would need to have a resolution error where a workspace package depending on another workspace package is in the tree (but the error is caused by something else). We would want to see that the hint is not displayed. I think this might be more trouble than it's worth at the moment, it seems hard to create. |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.4.13` -> `0.4.15` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.4.15`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0415) [Compare Source](astral-sh/uv@0.4.14...0.4.15) ##### Bug fixes - Revert "Treat invalid platform as more compatible than invalid Python ([#​7556](astral-sh/uv#7556))" ([#​7608](astral-sh/uv#7608)) ##### Documentation - Add the execution policy to powershell installs for single versions ([#​7602](astral-sh/uv#7602)) ### [`v0.4.14`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0414) [Compare Source](astral-sh/uv@0.4.13...0.4.14) ##### Breaking - Move uvx shell completion to `uvx --generate-shell-completion` ([#​7511](astral-sh/uv#7511)) ##### Enhancements - Adjust messaging for frozen hint on resolution failure during `uv add` ([#​7597](astral-sh/uv#7597)) - Provide resolution hints in case of possible local name conflicts ([#​7505](astral-sh/uv#7505)) - Improve Docker image release tagging order and display on `ghcr.io` ([#​7568](astral-sh/uv#7568)) - Improve deserialization error messages ([#​7598](astral-sh/uv#7598)) ##### Bug fixes - Allow system environments during project environment validity check ([#​7585](astral-sh/uv#7585)) - Avoid validating workspace members when `--no-sources` is provided ([#​7599](astral-sh/uv#7599)) - Fix handling of `sys.base_prefix` collision in interpreter identity check during tool installs ([#​7596](astral-sh/uv#7596)) - Make `uv cache prune` robust to unreadable rkyv entries ([#​7561](astral-sh/uv#7561)) - Revert "Remove duplicate warning for settings discovery errors ([#​7384](astral-sh/uv#7384))" ([#​7594](astral-sh/uv#7594)) ##### Documentation - Fix `-` to `_` in packaged applications document ([#​7571](astral-sh/uv#7571)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This enhances the hints generator in the resolver with some heuristic to detect and warn in case of failures due to version mismatches on a local package. Those may be the symptom of name conflict/shadowing with a transitive dependency.
Closes: #7329