-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Correctly assign configuration to origin files with pip config
#12201
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
Conversation
acede62
to
14b5170
Compare
14b5170
to
683d7cd
Compare
Thank you, updated! |
Thanks for filing this PR! ^>^ Could you update the output to indent the configuration values by one level more compared to the output line about the origin file? i.e. $ python -m pip config debug
env_var:
env:
global:
/etc/xdg/xdg-ubuntu/pip/pip.conf, exists: False
/etc/xdg/pip/pip.conf, exists: True
install.require-virtualenv: true
/etc/pip.conf, exists: True
global.timeout: 60
site:
/home/user/.virtualenvs/pip-dev/pip.conf, exists: False
user:
/home/user/.pip/pip.conf, exists: True
install.require-virtualenv: true
/home/user/.config/pip/pip.conf, exists: True
global.timeout: 60
test.blah: 1
test.blaha: 1 |
You're welcome!
I'm sorry, that's actually the default behaviour - my Updated the example. I sure agree it looks better! |
Thank you for the code refinery suggestions! I've applied them. |
Looks good. Can we add some tests for this? |
dcf53da
to
d9b5a9d
Compare
@uranusjr I have added a test. Do you have a suggestion how to touch the configuration file platform-independent? |
Looks like there’s some problem with test setup, the config is not where you expect it to be. |
Don't know why, but on Windows the the
Can I run a simple replace on that? |
IMO, only if you add a comment to the test explaining why you needed to do so for future maintainers. And if you can write such a comment, you'd probably be better just fixing the test to look in the correct place 🙂 |
I think that's actually state leaking between tests, which is what is causing the failure here. Doing a replace seems like a bodge and, ideally, we would instead change Maybe, that should delete |
87e2b83
to
8d6c282
Compare
@chrysle Please run |
Sure, done; I wanted to rebase after checking if your solution would work. Do you have another suggestion how to handle the issue? I can't test on Windows, unfortunately. |
Have you tried this yet? |
Co-authored-by: Tzu-ping Chung <[email protected]> Co-authored-by: Pradyun Gedam <[email protected]>
af49b81
to
0fa9647
Compare
@chrysle are you interested in fixing the failing test on Windows CI and fixing the merge conflicts? This PR looks pretty close to be ready to be merged. It's okay if you aren't! |
I am, unfortunately I don't know how to do that. I don't use Windows and thus can not investigate this properly. Any help would be greatly appreciated. |
With modern type annotations applied (and one typo fix).
60298c8
to
061dbbd
Compare
I was confused with the code duplication. I tried to remove it and realized that envvars were not migrated to the I'm trying my darnest to fix the tests on Windows. It looks like state leaks between the tests conditionally (probably based off whether the OS global configuration directory is writable or not). Once that's fixed, I'll merge this. Thank you @chrysle for the contribution! |
I think I figured it out, platformdirs is caching the Windows user site directory which obviously is not going to end well here. I added a teardown fixture that clears this cache. Sigh. |
46632f4
to
226ef40
Compare
That did not fix it. Whelp. I give up for the night. Will come back to this later. |
Oh wait, updating Lines 236 to 248 in 8c3a68d
The better fix is to run |
Fixes #12099
This pull requests extends the
pip
configuration dictionary to be nested, allowing the configuration keys to be connected with the origin files. It will look like this:pip config debug
correctly separates the configuration:I'm not satisfied with the implementation, though... Happy about review feedback!