A standard location for Python configuration files.

Hello, As discussed in issue #7175 and on irc, I would like to propose the addition of a new function called 'getuserconfig' in site.py. This function will return the path to a directory that will contain configuration files for Python. The name I am suggesting for the path of the folder is: ~/.python with an alternative location for win32 : ~/python This win32 alternative is proposed to avoid the fact that it's not possible in some flavors of windows to manually create a folder that starts with a dot when using file graphical browser. That's disturbing for end users. This will be used by Distutils to gather the configuration files it uses right now ([py]distutils.cfg and pypirc) and gently deprecate the old location (~) I am bringing this discussion to python-ideas to make sure those are the best choices, and to propose ~/[.]python as the new standard location for any user configuration file Python currently uses or might use in the future. Regards, Tarek

What configuration files exactly do you think will be stored in this location in the future (other than the ones for distutils)? In let's say today's python 2.5 or 2.6 what config files would you put there if this capability would be there currently? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown

Tarek Ziadé wrote:
PEP 370 already addresses this issue of version specific and general config files. Even if you prefer to use a different naming schema than I've suggested in PEP 370 you shouldn't use your suggested paths. For Unix ~/.python might already be used. At least it's used on my box as a script that is loaded through PYTHONSTARTUP to active tab completion in interactive Python shells. The path ~/python on Windows violates Windows naming schema. Application must not use the root directory of a user's home folder to store data. Instead you should use the application data folder. Christian

On Thu, Oct 22, 2009 at 11:53 AM, Christian Heimes <lists@cheimes.de> wrote:
Yes, but it doesn't address the configuration files issue. If I make the same analogy (./local <-> /usr/local) where in .local would I place those files ? Would it be ".local/etc" ? Tarek

Christian Heimes <lists@...> writes:
PEP 370 already addresses this issue of version specific and general config files.
Please, no. As I said in #7175, ~/.local is the user-specific equivalent of /usr or /usr/local. Do you put your configuration files in /usr/local ? Why put them in .local ? An Unix user will look for Python configuration files in his home directory, and then perhaps in a subdirectory named .python or .py<something>. *Not* in .local, which is a place for locally installed stuff, not user-editable config files.
I don't find this argument very serious. The Python interpreter reclaiming the ~/.python directory only seems natural and reasonable to me. If we follow your argument we can't introduce *any* new location just because someone might already use it. This is quite unacceptable.

Antoine Pitrou wrote:
First of all we should discuss if we are talking about automatically generated config files or human editable config files. If the configuration files are frequently edited by a user than ~/.local or ~/.config aren't the best place.
The path ~/.python is a so obvious choice for a file or directory that contains Python specific stuff that it probably used by lots of people. If we are going to introduce a directory in the user's home directory and not in some subfolder like ~/.local or ~/.config, then I like to stick to another Unix tradition. Configuration directories are usually suffixed with ".d". How about ~/.python.d/? Christian

On Thu, Oct 22, 2009 at 01:13:36PM +0200, Christian Heimes wrote:
Configuration directories are usually suffixed with ".d". How about ~/.python.d/?
I have 40 config directories in my $HOME, and none of them ends with ".d". -1. ".d" are usually directories in /etc that are referenced from main config file; for example /etc/logrotate.conf does "include /etc/logrotate.d/". Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.

On Thu, Oct 22, 2009 at 1:13 PM, Christian Heimes <lists@cheimes.de> wrote:
In Distutils, those are human-readable files.
I can understand the concerns about ~/.python but I find ~/.python.d/ rather cryptic. What about a more explicit name like ~/.pythonconfig then ? Tarek

Tarek Ziadé writes:
I can understand the concerns about ~/.python but I find ~/.python.d/ rather cryptic.
True, but it's an existing convention quite widely used. Mac OS X itself has at least nine. That increases by more than an order of magnitude on my system if I don't filter "/opt/local" (MacPorts). I'm not even going to bother trying to count on Gentoo Linux.
What about a more explicit name like ~/.pythonconfig then ?
-0.5 vs /.python.d.

On Thu, Oct 22, 2009 at 6:36 PM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
If we stick to per-user configuration files located in ~, the only one I have found on my Mac OS X and Debian was from Pylint (.pylint.d) (I use MacPorts on Mac) But others known softwares I have don't use .d for their config directories: Mac: - .dropbox/ - .macports/ - .cups/ Debian: - .aptitude/ - .ipython/ - .subversion/ and so on.. (I couldn't find any documented convention yet on those directories) At the end, I also think ~/.python is the best choice, If a Python software use this name, it's not a problem since the old places will still be used, but with a deprecation warning, meaning that the incriminated software will have until Python 2.8 and 3.3 to change its configuration filename. Tarek

Well, I'm not sure what a non-human editable config file would be. Of course, stuff which is not meant to be edited by a human can (should?) go into .local. But for a human-editable config file, to place it in .local is quite unintuitive.
Well, I have only two of them here: ".pylint.d" and ".emacs.d"; the other configuration directories don't have a ".d" suffix. But the point is really that it's natural and legitimate for Python to use a ".python" directory. It's not like we are planning to call it ".config" or ".settings". Regards Antoine.

Christian Heimes <lists@cheimes.de> writes:
Configuration directories are usually suffixed with ".d". How about ~/.python.d/?
No, configuration directories are not usually named with a ‘.d’ suffix. A configuration directory named with a ‘.d’ suffix is a usage that has the specific connotation of “when reading the configuration, read *all files* in this directory as a unified set of configuration settings”. Examples from a Debian system I have access to include ‘/etc/cron.d/’, ‘/etc/logrotate.d/’, ‘/etc/apache/conf.d/’, ‘/etc/fonts.d/’, ‘/etc/rc2.d/’. (There are exceptions that don't follow that semantic as well, like ‘/etc/init.d/’, ‘$HOME/.emacs.d/’, and ‘/etc/pam.d/’. It's not a universally-honoured convention.) Whereas “directory containing discrete configuration files, each of which will be read only under specific circumstances” are generally *not* named with a ‘.d’ suffix. If you're going to have a set of discretely-interpreted configuration files, it's best to avoid naming it with the ‘.d’ suffix. -- \ “There was a point to this story, but it has temporarily | `\ escaped the chronicler's mind.” —Douglas Adams | _o__) | Ben Finney

Christian Heimes schrieb:
+1
The path ~/.python is a so obvious choice for a file or directory that contains Python specific stuff that it probably used by lots of people.
Such as? What program would use .python with a good reason? I'd like to see some proof that anything is using .python. I've looked at Google codesearch, and the only thing the string constant ".python" seems to be used for is an alternate file name extension. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.

What configuration files exactly do you think will be stored in this location in the future (other than the ones for distutils)? In let's say today's python 2.5 or 2.6 what config files would you put there if this capability would be there currently? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown

Tarek Ziadé wrote:
PEP 370 already addresses this issue of version specific and general config files. Even if you prefer to use a different naming schema than I've suggested in PEP 370 you shouldn't use your suggested paths. For Unix ~/.python might already be used. At least it's used on my box as a script that is loaded through PYTHONSTARTUP to active tab completion in interactive Python shells. The path ~/python on Windows violates Windows naming schema. Application must not use the root directory of a user's home folder to store data. Instead you should use the application data folder. Christian

On Thu, Oct 22, 2009 at 11:53 AM, Christian Heimes <lists@cheimes.de> wrote:
Yes, but it doesn't address the configuration files issue. If I make the same analogy (./local <-> /usr/local) where in .local would I place those files ? Would it be ".local/etc" ? Tarek

Christian Heimes <lists@...> writes:
PEP 370 already addresses this issue of version specific and general config files.
Please, no. As I said in #7175, ~/.local is the user-specific equivalent of /usr or /usr/local. Do you put your configuration files in /usr/local ? Why put them in .local ? An Unix user will look for Python configuration files in his home directory, and then perhaps in a subdirectory named .python or .py<something>. *Not* in .local, which is a place for locally installed stuff, not user-editable config files.
I don't find this argument very serious. The Python interpreter reclaiming the ~/.python directory only seems natural and reasonable to me. If we follow your argument we can't introduce *any* new location just because someone might already use it. This is quite unacceptable.

Antoine Pitrou wrote:
First of all we should discuss if we are talking about automatically generated config files or human editable config files. If the configuration files are frequently edited by a user than ~/.local or ~/.config aren't the best place.
The path ~/.python is a so obvious choice for a file or directory that contains Python specific stuff that it probably used by lots of people. If we are going to introduce a directory in the user's home directory and not in some subfolder like ~/.local or ~/.config, then I like to stick to another Unix tradition. Configuration directories are usually suffixed with ".d". How about ~/.python.d/? Christian

On Thu, Oct 22, 2009 at 01:13:36PM +0200, Christian Heimes wrote:
Configuration directories are usually suffixed with ".d". How about ~/.python.d/?
I have 40 config directories in my $HOME, and none of them ends with ".d". -1. ".d" are usually directories in /etc that are referenced from main config file; for example /etc/logrotate.conf does "include /etc/logrotate.d/". Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.

On Thu, Oct 22, 2009 at 1:13 PM, Christian Heimes <lists@cheimes.de> wrote:
In Distutils, those are human-readable files.
I can understand the concerns about ~/.python but I find ~/.python.d/ rather cryptic. What about a more explicit name like ~/.pythonconfig then ? Tarek

Tarek Ziadé writes:
I can understand the concerns about ~/.python but I find ~/.python.d/ rather cryptic.
True, but it's an existing convention quite widely used. Mac OS X itself has at least nine. That increases by more than an order of magnitude on my system if I don't filter "/opt/local" (MacPorts). I'm not even going to bother trying to count on Gentoo Linux.
What about a more explicit name like ~/.pythonconfig then ?
-0.5 vs /.python.d.

On Thu, Oct 22, 2009 at 6:36 PM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
If we stick to per-user configuration files located in ~, the only one I have found on my Mac OS X and Debian was from Pylint (.pylint.d) (I use MacPorts on Mac) But others known softwares I have don't use .d for their config directories: Mac: - .dropbox/ - .macports/ - .cups/ Debian: - .aptitude/ - .ipython/ - .subversion/ and so on.. (I couldn't find any documented convention yet on those directories) At the end, I also think ~/.python is the best choice, If a Python software use this name, it's not a problem since the old places will still be used, but with a deprecation warning, meaning that the incriminated software will have until Python 2.8 and 3.3 to change its configuration filename. Tarek

Well, I'm not sure what a non-human editable config file would be. Of course, stuff which is not meant to be edited by a human can (should?) go into .local. But for a human-editable config file, to place it in .local is quite unintuitive.
Well, I have only two of them here: ".pylint.d" and ".emacs.d"; the other configuration directories don't have a ".d" suffix. But the point is really that it's natural and legitimate for Python to use a ".python" directory. It's not like we are planning to call it ".config" or ".settings". Regards Antoine.

Christian Heimes <lists@cheimes.de> writes:
Configuration directories are usually suffixed with ".d". How about ~/.python.d/?
No, configuration directories are not usually named with a ‘.d’ suffix. A configuration directory named with a ‘.d’ suffix is a usage that has the specific connotation of “when reading the configuration, read *all files* in this directory as a unified set of configuration settings”. Examples from a Debian system I have access to include ‘/etc/cron.d/’, ‘/etc/logrotate.d/’, ‘/etc/apache/conf.d/’, ‘/etc/fonts.d/’, ‘/etc/rc2.d/’. (There are exceptions that don't follow that semantic as well, like ‘/etc/init.d/’, ‘$HOME/.emacs.d/’, and ‘/etc/pam.d/’. It's not a universally-honoured convention.) Whereas “directory containing discrete configuration files, each of which will be read only under specific circumstances” are generally *not* named with a ‘.d’ suffix. If you're going to have a set of discretely-interpreted configuration files, it's best to avoid naming it with the ‘.d’ suffix. -- \ “There was a point to this story, but it has temporarily | `\ escaped the chronicler's mind.” —Douglas Adams | _o__) | Ben Finney

Christian Heimes schrieb:
+1
The path ~/.python is a so obvious choice for a file or directory that contains Python specific stuff that it probably used by lots of people.
Such as? What program would use .python with a good reason? I'd like to see some proof that anything is using .python. I've looked at Google codesearch, and the only thing the string constant ".python" seems to be used for is an alternate file name extension. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out.
participants (8)
-
Antoine Pitrou
-
Ben Finney
-
Christian Heimes
-
Daniel Fetchinson
-
Georg Brandl
-
Oleg Broytman
-
Stephen J. Turnbull
-
Tarek Ziadé