Skip to content

Conversation

@gdiepen
Copy link

@gdiepen gdiepen commented Dec 15, 2025

With the merging of PR #12201, an additional layering was added to the variants in the Configuration, namely to hold the filename from which this variant was read.

This extra layer broke the original fallthrough logic of being able to overrule configuration options in the global config with back to default settings from the user config.

This PR re-implements the fallthrough logic, but now in the _get_ordered_configuration_items in the ConfigOptionParser. Instead of constructing the section_items directly as a list of key-value tuples per section, we first create a dictionary of key-value items per section (which ensures we just keep one value per key) and then convert this in one go to the original dictionary per section of a key-value list

Fixes #13696

With the merging of PR pypa#12201, an additional layering was added to the
variants in the Configuration, namely to hold the filename from which
this variant was read.

This extra layer broke the original fallthrough logic of being able to
overrule configuration options in the global config with back to default
settings from the user config.

This PR re-implements the fallthrough logic, but now in the
_get_ordered_configuration_items in the ConfigOptionParser. Instead of
constructing the section_items directly as a list of key-value tuples
per section, we first create a dictionary of key-value items per section
(which ensures we just keep one value per key) and then convert this in
one go to the original dictionary per section of a key-value list
@gdiepen
Copy link
Author

gdiepen commented Dec 15, 2025

Would be happy to add a test also, but not really sure how I would need to do that and what would work during the execution of the tests and what not.

In essence, I would like to do the exact same thing I stated in my original issue:

pip config set --global global.proxy http://non_existing_proxy_server.tld
pip config set --user global.proxy ""

pip install requests

This should result in requests being installed (or whatever package we want to test with). I did do a quick test with pip config get global.proxy but that actually shows the correct value: empty string. Just during the main program with install it goes wrong.

@notatallshaw
Copy link
Member

Thanks for the PR, please be aware maintainer resources are fairly limited right now, doubly so as we reach the end of the year. But I will priotize reviewing this before the next release if no one else does first.

@notatallshaw notatallshaw added this to the 26.0 milestone Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty user-settings do not overrule global settings anymore

2 participants