Skip to content
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

macOS: use ~/.config/pip/pip.conf as default as well (#4100) #4124

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

atdaemon
Copy link
Contributor

@atdaemon atdaemon commented Nov 20, 2016

This commit will use ~/.config/pip as config directory if ~/Library/Application Support/pip directory does not exist on macOS.
Updated doc as well.

Tested by adding a logger that lists all config files in get_config_files method -

$ ls ~/Library/Application\ Support/pip
ls: /Users/anish/Library/Application Support/pip: No such file or directory
$ pip 1>/dev/null
WARNING:pip.baseparser:get_config_files - ['/Library/Application Support/pip/pip.conf', '/Users/anish/.pip/pip.conf', '/Users/anish/.config/pip/pip.conf']
$ mkdir ~/Library/Application\ Support/pip
$ pip 1>/dev/null
WARNING:pip.baseparser:get_config_files - ['/Library/Application Support/pip/pip.conf', '/Users/anish/.pip/pip.conf', '/Users/anish/Library/Application Support/pip/pip.conf']
$ rm -rf ~/Library/Application\ Support/pip/
$ pip 1>/dev/null
WARNING:pip.baseparser:get_config_files - ['/Library/Application Support/pip/pip.conf', '/Users/anish/.pip/pip.conf', '/Users/anish/.config/pip/pip.conf']

This change is Reviewable

@xavfernandez xavfernandez added the OS: macos MacOS specific label Nov 20, 2016
@atdaemon atdaemon force-pushed the osx-pip-conf branch 4 times, most recently from 5350c78 to 9a91df8 Compare December 24, 2016 11:10
@atdaemon
Copy link
Contributor Author

Hi @xavfernandez , please take a look.
This one is for issue #4100
Thanks!

@xavfernandez xavfernandez added this to the 9.1 milestone Jan 17, 2017
@xavfernandez
Copy link
Member

Hello, as I have no knownledge of the macOS ecosystem I've no idea wheither this new location would make sense.
Maybe @dstufft or @pfmoore have an opinion on the topic ?

@pfmoore
Copy link
Member

pfmoore commented Jan 17, 2017

Sorry, I also have no knowledge of OSX

@tweekmonster
Copy link

@mhinz and myself have lots of knowledge of macOS. Yes, this location makes sense.

$HOME/Library/Application Support is typically for GUI applications and it's supposed to be the application's support files. Typically files generated by the application for the user's benefit. It's the equivalent of $XDG_DATA_HOME. This is probably the worst place for a command line tool's configs.

$HOME/Library/Preferences is the closest thing to $XDG_CONFIG_HOME. It's expected that the configs are named using a bundle identifier (e.g. io.pypa.pip) and that it's in the plist format. This is the default location when using the defaults command line tool, or NSUserDefaults in Cocoa applications: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/UserDefaults/AboutPreferenceDomains/AboutPreferenceDomains.html

It's pretty annoying when third party command line tools use either of those directories. The file/directory names are often not what you expect making it hard to find or even discern if configs exist. They're also not tab completion friendly because these directories exist:

$HOME/Library/Application Scripts
$HOME/Library/Application Support
$HOME/PreferencePanes
$HOME/Preferences

It's easier on developers when config locations are predictable on all *nix OSes, macOS being no exception.

@xavfernandez xavfernandez merged commit 85b5b16 into pypa:master Mar 2, 2017
@xavfernandez
Copy link
Member

After checking with a few mac users, they agreed it made more sense. Thanks.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation OS: macos MacOS specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants