Fix invalid config values soft-locking pip#14011
Conversation
ichard26
left a comment
There was a problem hiding this comment.
I'm confused, the PR claims to only prevent invalid use-feature values from stopping pip to function, but this seems to ignore all invalid configuration keys?
|
You're right. While the issue was reported for The PR title and news entry are too narrowly scoped given what the change actually does. I'll update them. |
use-feature value soft-locking pip|
I'm not sure if ignoring invalid values for all configuration options is a good idea. For example, if someone uses
There are similar concerns with options like |
I see your point, and I agree that users should be clearly informed when they're relying on a feature that no longer exists. At the same time, I think preventing users from using pip entirely, especially with the current error message, can be frustrating for users. I think there are two possible approaches:
I'd be interested to hear which approach you think is more reasonable. |
I'd say the third option is to (somehow) scope this PR down so that it only applies to the --use-feature flag, which is what the original issue asked for. |
That's a possible solution, but I don't think it addresses the root issue. Narrowing the scope avoids the immediate problem, but we'll probably just see another issue opened later when |
|
The three options you mention are imo very much different and should be treated differently. --exists-action seem to have a well-defined set of options so pip should error out if a wrong one is provided. On the other hand, the list of possible options for -use-feature and -use-deprecated changes in different pip versions so it makes sense to be more lenient. Especially for use-feature, where the user is supposedly opting into a future feature so we should not punish them once the future finally arrives and the feature is stable. |
Good point. What do you think about taking a more balanced approach? We could warn and ignore invalid values for |
Yes, I think this would make sense. |
|
I updated the code to reflect the discussion we had. Pip now warns on invalid |
Co-authored-by: Richard Si <sichard26@gmail.com>
|
Since pip becomes completely unusable when a configuration value (besides |
|
Thanks for the review! I replaced the config file name with a link to the documentation to avoid ambiguity, and switched to But I think that's outside the scope of this PR and would be better addressed separately. |
Fixes #8671. Warn and skip invalid use-feature config values instead of crashing.
I also had to keep track of the invalid variables because
check_defaultwas called a lot, creating many duplicate logging messages.Happy to adjust the approach if maintainers have a different preference.