The new pip resolver is not backwards compatible#5540
Conversation
|
Instead of having to rely on a relatively slow retry, could we somehow detect that it's not available and get it right the first time? 🤔 |
|
Possibly, I took the python approach of "ask forgiveness not permission" initially. I contemplated using the python version which we have at hand though that might not be specific enough for all cases, it would be best if we could use the pip-compile or pip-tools version, but I didn't see a quick/easy way to get that other than shelling out, so went this direction. I'll make another attempt. Also of note would be we should start seeing the incidence of python 3.6 drop off, and we'll most likely be removing these checks next April (when we hopefully remove 3.6 support), so hopefully the number of times we hit the retry would be low and getting lower. |
| ) | ||
| end | ||
|
|
||
| def backwards_compat? |
There was a problem hiding this comment.
Total nit, would this name make things clearer?
| def backwards_compat? | |
| def new_resolver_supported? |
(and then flip the logic in the rest of the code)
| def unknown_option_error?(error) | ||
| error.message.include?(UNKNOWN_OPTION_ERROR) | ||
| end | ||
|
|
jurre
left a comment
There was a problem hiding this comment.
Overall direction looks great to me, I made a readability suggestion and what I think might be an unused method
| end | ||
|
|
||
| def new_resolver_supported? | ||
| python_version.to_s.start_with?("3.6") |
There was a problem hiding this comment.
Should this now be:
| python_version.to_s.start_with?("3.6") | |
| !python_version.to_s.start_with?("3.6") |
Or what about:
| python_version.to_s.start_with?("3.6") | |
| python_version >= Python::Version.new("3.6") |
There was a problem hiding this comment.
I think we'd have to do python_version >= Python::Version.new("3.7"). This is the best option I think.
Fixes #5405
Adding error handling and a retry if the pip-compile is not new enough to have the --resolver argument.