[Python-Dev] Fixing #7175: a standard location for Python config files

Michael Foord fuzzyman at voidspace.org.uk
Fri Aug 13 23:02:45 CEST 2010


On 13/08/2010 06:39, Stephen J. Turnbull wrote:
> Michael Foord writes:
>
>   >  How is ~/python not memorable or consistent? (And cross-platform
>   >  memorability and consistency is valuable too.)
>
> But what does "~" mean on Windows?
There is a "user directory" in Windows directly analagous to ~, and this 
is the path returned by os.path.expanduser('~') in Python:

 >>> import os
 >>> os.path.expanduser('~')
'C:\\Users\\michael'

(Windows 7)

> Inside of Python you can have a
> consistent definition, but that doesn't help people whose installer
> gets mixed signals so Python itself is in the wrong place, or who are
> using external tools (uninstaller, editor, application, etc) that work
> on or with Python.
>
> I'm not arguing for use of AppData, but at least it's easy to explain,
> and easy to implement, for consistency.
>
>    

Likewise with the user directory (IMO) - in fact to explain where 
AppData is to a Windows user you first explain about the user directory 
(AppData is under the user directory).

Personally I would like to see the defaults being:

Linux: ~/.pythonx.y
Mac OS X: ~/.pythonx.y with a fallback of ~/Library/Preferences/.pythonx.y
Windows: ~/pythonx.y perhaps with a backup of AppData/pythonx.y

For both Windows and Mac OS X I would be happy with the fallback / 
primary to be the other way round - it doesn't *really* matter. The API 
for getting the user config direction should always return a list I 
guess if we have fallbacks.

Someone else in this thread (Adal Chiriliuc) expressed a preferences for 
the documents folder on Windows over the home directory. This would be 
fine as well (with AppData still as a fallback). This is used by other 
native windows applications. (In earlier versions of Windows the 
documents folder was explicitly called "Documents and Settings".)

We should use pythonx.y rather than just python because (for example) 
you will typically have different packages installed when you have 
multiple versions of Python, and in unittest would then want / need 
different plugins enabled and configured in the unittest config files 
for each of the versions of Python.

I've added this text to the issue and Tarek - as bdfl for distutils2 
should just make a decision (and the rest of us will have to live with 
it). :-)
>   >  Another issue is discoverability. Many users won't know about these
>   >  config files unless they *see* them.
>
> OK, maybe AppData's out.
>
>   >  In fact for Windows the *correct* thing to do is probably to use
>   >  the registry and then provide a graphical tool for editing the
>   >  values. If you're arguing for consistency why not argue for this?
>
> Sounds reasonable to me.  Except Python's standard GUI is probably not
> up to Windows standards of beauty....
>
>    

Heh, I was actually being slightly sarcastic - just pointing out that if 
we are going to argue that we should do the "correct" thing for the 
platform that means the registry on Windows and plists on Mac OS X, with 
GUI apps to control them. That is an unnecessary burden for the standard 
library and actively makes them harder for developers to maintain 
themselves.

All the best,

Michael Foord

-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.




More information about the Python-Dev mailing list