Issue7175
Created on 2009-10-20 11:21 by tarek, last changed 2011-06-24 13:13 by eric.araujo.
| Messages (35) | |||
|---|---|---|---|
| msg94272 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-20 11:21 | |
[.]pydistutils.cfg will be deprecated in favor of a single "distutils.cfg", located in .local/ alongside the files added for example by the per user-site packages. |
|||
| msg94279 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2009-10-20 14:39 | |
Why is this? .local/ contains machine-installed files while .pydistutils.cfg is edited by the user. |
|||
| msg94281 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-20 14:55 | |
That's what is returned by site.getuserbase() (which uses PYTHONUSERBASE, and defaults to ~/.local) PYTHONUSERBASE is the root of Python user-specific paths so it makes sense to have all Python related files in there. This came up with the discussion we had with others at Distutils-SIG read this thread here for more info: http://mail.python.org/pipermail/distutils-sig/2009-August/012865.html [.]pypirc should probably go there too. |
|||
| msg94282 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2009-10-20 15:03 | |
> That's what is returned by site.getuserbase() > > (which uses PYTHONUSERBASE, and defaults to ~/.local) Well, that makes it the user-specific equivalent of /usr or /usr/local. Do you put your configuration files in /usr/local ? Why put them in .local ? > PYTHONUSERBASE is the root of Python user-specific paths so it makes > sense to have all Python related files in there. That doesn't make sense actually, since .local isn't Python-specific. :) |
|||
| msg94284 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2009-10-20 15:11 | |
I've read the thread now and I think the original proposal of having a ~/.python was more sensible and more user-friendly. |
|||
| msg94285 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2009-10-20 15:17 | |
+1 to what Antoine said. |
|||
| msg94287 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-20 15:21 | |
> Well, that makes it the user-specific equivalent of /usr or /usr/local. > Do you put your configuration files in /usr/local ? > Why put them in .local ? The distutils.cfg file is located in the distutils package itself ! So the target is ~/.local/pythonX.X/site-packages/distutils/distutils.cfg (sorry if that was unclear) Now, I would totally agree to have a better ~/.NAME to reunite user-specific *configuration* file for Python, but that would be yet another directory for user-specific Python files. |
|||
| msg94288 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2009-10-20 15:37 | |
> The distutils.cfg file is located in the distutils package itself ! > > So the target is ~/.local/pythonX.X/site-packages/distutils/distutils.cfg Ah, that's horrible. -1 to that. Configuration files should be easily findable by skimming through the dot-files in the user's directory. ~/.python fulfills that condition. |
|||
| msg94289 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-20 15:50 | |
I like ~/.python very much too (that was my initial proposal IIRC). I guess the best way to add this support is to provide a new api in site.py, that returns this folder. Distutils can move pypirc and distutils.cfg file there. Now for the global distutils.cfg, if we want to have it somewhere else that the distutils package directory itself, we would need a "/etc/python" scheme for instance, that could be also added in site.py. I don't know though how the latter would look under windows |
|||
| msg94293 - (view) | Author: Marc-Andre Lemburg (lemburg) * ![]() |
Date: 2009-10-20 17:32 | |
Tarek Ziadé wrote: > > Tarek Ziadé <ziade.tarek@gmail.com> added the comment: > > I like ~/.python very much too (that was my initial proposal IIRC). +1 on that name as well. One thing to note though: it is well possible that a user uses multiple Python versions. With just one such directory, all versions would look in the same directory for the configuration files and this could lead to incompatibilities, e.g. Python 2.7 might not like that Python 3.6 needs in some config file (for whatever reason). > Now for the global distutils.cfg, if we want to have it somewhere else > that the distutils package directory itself, we would need a > "/etc/python" scheme for instance, that could be also added in site.py. > > I don't know though how the latter would look under windows I think Subversion get's this pretty right, so we might want to follow their scheme: http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1 |
|||
| msg94412 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-24 12:56 | |
The subversion system looks pretty nice ! So here's a modified proposal that covers the python version as well. = per user configuration files = ~/.pythonMAJOR.MINOR Examples: ~/.python2.7 ~/.python3.1 On Windows, ~ will be replaced by APPDATA if founded in the environment. == global configuration files == On Linux/Mac: /etc/pythonMAJOR.MINOR examples: /etc/python2.7/ /etc/python3.1/ On Windows: \All users\Application Data\PythonMAJORMINOR (\All users\Application Data is specified by the Windows Registry) examples: \All users\Application Data\Python26 \All users\Application Data\Python31 == standard naming for configuration files == The files are all named "NAME.cfg", in all platforms. == what gets in per-user configuration directory == - pypi.cfg - distutils.cfg == what gets in global configuration directory == - distutils.cfg == apis added == in site.py: - getuserconfig() : returns the per-user configuration directory - getconfig(): returns the global configuration directory (the names are following site.py naming style) |
|||
| msg94507 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2009-10-26 21:06 | |
FYI, /etc/pythonX.Y (and /etc/python) are used by Debian; the former contains site.py and sitecustomize.py, the latter a file called debain_config. I can't see how this could become a problem, but maybe someone else does. |
|||
| msg94519 - (view) | Author: Tarek Ziadé (tarek) * ![]() |
Date: 2009-10-26 22:04 | |
Thanks for the info Georges. I am adding Matthias and Michael so they can give us their opinions for their platforms (Debian/Ubuntu and Win) |
|||
| msg94523 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2009-10-26 22:12 | |
Personally I'm uncomfortable with creating yet-another-location-for-config-files. As we now have is ~/.local/pythonX.Y I would reuse this. |
|||
| msg94527 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2009-10-26 22:28 | |
But ~/.local is simply not the location for config files. |
|||
| msg94530 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2009-10-26 22:35 | |
For Linux and Mac OS X put the config file wherever the 'right' place is then, but we are starting to create a lot of new directories disparate from the actual install. Oh well. On Windows we create: %APPDATA%/Python/PythonX.Y/site-packages If it is to no longer live inside distutils (which seems reasonable) then on Windoze a 'good' place would seem to be: %APPDATA%/Python/PythonX.Y/ On Windows there is no 'right' place, the officially right place for the system is probably the registry but I don't think many Python programmers would thank you for that... |
|||
| msg94531 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2009-10-26 22:36 | |
Noting of course that on IronPython it should be: %APPDATA%/IronPython/PythonX.Y/ or wherever we decided in the end. :-) |
|||
| msg94620 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2009-10-28 09:40 | |
/etc is definitely not the right place to put files for OS X framework builds; if necessary, an etc directory could be added under the framework version directory as a sibling of bin and lib. It's also very un-OS X like to be putting things into ~/.python and ~/.local directories; the usual place would be in somewhere ~/Library, possibly ~/Library/Application Support/Python or ~/Library/Frameworks. Keep in mind that it's much more likely on OS X to not only have muitiple versions of Python installed but also more than one instance of the *same* version, for instance, on 10.6, an Apple-supplied 2.6.2 and a python.org 2.6.4. Some thought should be given to locations for the files for Unix-style (non-framework) builds. (Adding Ronald.) |
|||
| msg94622 - (view) | Author: Marc-Andre Lemburg (lemburg) * ![]() |
Date: 2009-10-28 09:46 | |
Ned Deily wrote: > > Ned Deily <nad@acm.org> added the comment: > > /etc is definitely not the right place to put files for OS X framework > builds; if necessary, an etc directory could be added under the > framework version directory as a sibling of bin and lib. It's also very > un-OS X like to be putting things into ~/.python and ~/.local > directories; the usual place would be in somewhere ~/Library, possibly > ~/Library/Application Support/Python or ~/Library/Frameworks. Keep in > mind that it's much more likely on OS X to not only have muitiple > versions of Python installed but also more than one instance of the > *same* version, for instance, on 10.6, an Apple-supplied 2.6.2 and a > python.org 2.6.4. Some thought should be given to locations for the > files for Unix-style (non-framework) builds. > > (Adding Ronald.) I think there is a misunderstanding here: we're trying to find places where distutils would look by default, not where it would write files. AFAIK, there is general agreement that when writing files, Python should use the ~/.local/pythonX.X/ directory. OTOH, searching for config files that the user creates and puts in place is another story. Python and distutils only need to be able to find these and the idea is to use platform specific standard search paths for this, so that the user can place those config files into places that feel right on each platform. |
|||
| msg94623 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2009-10-28 10:24 | |
I don't think there's a misunderstanding. By "putting", I meant "reading" or "writing". IMO, /etc is not the place on OS X to be looking for python-related configuration files, certainly not for framework installs. Likewise for ~/.python and ~/.local. Unfortunately, the latter is already out in the field; that was a step in the wrong direction for OS X. |
|||
| msg94637 - (view) | Author: Ronald Oussoren (ronaldoussoren) * ![]() |
Date: 2009-10-28 20:11 | |
I agree with Ned that neither ~/.local nor /etc are a good fit for OSX, sadly enough I wasn't paying attention when ~/.local was added as python already had a per-user directory on OSX: ~/Library/Python. The common unix directories are often not a good pick for good OSX citizens, even if OSX is build on Unix. The OSX filesystem structure should be described somewhere below <http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/ BPFileSystem/BPFileSystem.html#//apple_ref/doc/uid/10000185>, although I haven't found a clear explanation yet. Technically configuration files should be stored in /Library/Preferences (system wide) or ~/Library/Preferences (per user), but I'd say practicality beats purity here and I'd store configuration in /Library/Python/etc or ~/Library/Python/etc. BTW. I haven't read most of the discussion yet, I'll probably have more to add when I do. What I did notice was a proposal to store the distutils cfg file in ~/.local/lib/pythonX.Y/site- packages/distutils.cfg. IMHO that way to hidden and an unexpected location for storing configuration files. |
|||
| msg94963 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2009-11-06 03:10 | |
When ~/.local/lib was chosen for the user directory, the BaseDir Spec was given as prior example. Why not go the full way and follow the spec? The config file could be $XDG_CONFIG_HOME/python/distutils, with $XDG_CONFIG_HOME defaulting to ~/.config. References: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html http://www.freedesktop.org/wiki/Software/pyxdg (deals with freedesktop.org-approved file formats too; the part of the code that deals with paths would make a useful addition to the stdlib, as more and more applications follow the spec) |
|||
| msg112366 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2010-08-01 18:52 | |
As a (mainly ex) windows user I would hate to have user editable data in APPDATA as it is not a location the user ever expects to visit. The home directory, or a subdirectory thereof, for user editable app specific data is more usual and more friendly. |
|||
| msg112385 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2010-08-01 21:08 | |
I guess I misremembered. %APPDATA% is /usr/share, right? What I meant was the variable that expands to the “documents and settings” directory. |
|||
| msg112399 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2010-08-01 23:01 | |
Pointed out by Tarek: http://github.com/ActiveState/appdirs#readme (shame it doesn‘t follow the BaseDir Spec on Free OSes). |
|||
| msg112407 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2010-08-01 23:57 | |
I still think that user editable configuration data, at least on windows, is different from application data. It would definitely seem weird to me to have a config file in the %APPDATA% directory. %APPDATA% would be fine for a cache or other application specific data. On Windows I would expect something like: "c:\Documents and Settings\AppName" (Note the settings in Documents and settings... - although in Windows 7 I think this might just be Documents now.) |
|||
| msg112423 - (view) | Author: Glyph Lefkowitz (glyph) | Date: 2010-08-02 05:33 | |
> Well, that makes it the user-specific equivalent of /usr or /usr/local. > Do you put your configuration files in /usr/local ? Why put them > in .local ? Yes, software built for /usr/local will often respect /usr/local/etc in addition to /etc. Also, many desktop Linux applications put state into ~/.local/share/$appname. I am not sure about "configuration files", (apps that use ~/.local will typically use ~/.config for configuration, but that is a different thing entirely) but autotools applications built with '--prefix ~/.local' will often respect ~/.local/etc. > I agree with Ned that neither ~/.local nor /etc are a good fit for OSX, > sadly enough I wasn't paying attention when ~/.local was added as python > already had a per-user directory on OSX: ~/Library/Python. I argued loudly for consistency in treatment of UNIX-like OSes when this decision was being made, and I stand by that position. Why would you want to break software that works fine on BSD and Linux by requiring that it specifically test for OS X, and do the exact same thing, but in a different directory? (See <http://en.wikipedia.org/wiki/Single_UNIX_Specification#Mac_OS_X_and_Mac_OS_X_Server>) The addition of a per-user directory on OS X when there were no similar directories on other platforms was a weird oversight. The user site directory in Python 2.5 and earlier does not use any features of OS X and refers to ~/Library/Python only by convention. Plus, that convention didn't support the distutils properly anyway: if you put your library code into ~/Library/Python, where are you supposed to tell 'setup.py install' to put script files? With ~/.local, it's obvious: ~/.local/bin. The real OS X convention is to put your code _into your application bundle_, after all, not into random directories in ~/Library. If you don't have an application or framework bundle, you have one foot in UNIX-land already. The point of honoring platform conventions is to provide a consistent experience to users; some users on OS X will be expecting UNIX-like behavior, some will be expecting Framework-like behavior, and there is really no reason not to provide both. There is no reason not to consider /etc, for that matter. PHP, for example, still reads /etc/php.ini on OS X. |
|||
| msg113588 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2010-08-11 05:03 | |
FWIW, I’m no longer strongly advocating using $XDG_CONFIG_HOME, since it seems to have little acceptance outside of graphical applications. Using it *or* ~/.python (or ~/.pythonx.y) would work for me. Since this seems like a big change for no benefit in distutils, I’m reassigning to distutils2. To push this issue forward, I am writing an email to python-dev today. |
|||
| msg113646 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2010-08-12 01:10 | |
I’m retitling the bug, given its broader scope. Michael Foord added another stdlib example: IDLE config files. Python-dev thread: http://mail.python.org/pipermail/python-dev/2010-August/103011.html |
|||
| msg113830 - (view) | Author: Michael Foord (michael.foord) * ![]() |
Date: 2010-08-13 21:01 | |
It would be nice to settle this. 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 the Python-dev discussion 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. |
|||
| msg127241 - (view) | Author: Glyph Lefkowitz (glyph) | Date: 2011-01-28 02:05 | |
I agree with Michael Foord; my comment on issue 8404 <http://bugs.python.org/issue8084#msg122935> may be of interest to anyone looking at this as well. |
|||
| msg127320 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2011-01-28 17:27 | |
The issue proved more complicated than expected, due to antics of Mac OS X and Windows Vista, so I set it aside for later. I intend to summarize all useful comments from the python-dev thread and bug reports comments and try to reach agreement for 3.3. |
|||
| msg127336 - (view) | Author: Barry A. Warsaw (barry) * ![]() |
Date: 2011-01-28 20:17 | |
I'm mildly uncomfortable advocating many different new dot directories in $HOME (e.g. .python2.7 .python3.1 .python3.2). Let's say -0. Also, because of backward compatibility, I think most configuration files will end up being similar enough between Python versions. Without having thought through all the details, it seems that ~/.python would work in general for configuration files that are compatible across Pythons, with X.Y subdirectories for version specific config files. |
|||
| msg127340 - (view) | Author: Glyph Lefkowitz (glyph) | Date: 2011-01-28 20:31 | |
I would still prefer ~/.local/something-parallel-to-where-it's-usually-installed for its ease of documentation. But ~/.python/X.Y isn't terribly objectionable. A minor point about Michael Foord's fallback proposal: I don't know why everyone is so keen to stuff things into ~/Library on the mac, but dotfiles don't go in ~/Library/Preferences. While that directory isn't exclusively populated with plist files, it's pretty close. If you want to try for consistency with platform convention, 'org.python.distutils.cfg' would be a better name for it, but I've never hand-edited a text file in that directory either and I get the impression one isn't meant to. But, since framework builds of Python already has ~/Library/Python/X.Y directories that they look in for other things, that location should probably be recycled if one wishes to have a fallback. |
|||
| msg138940 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2011-06-24 13:13 | |
See also #12393. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2011-06-24 13:13:44 | eric.araujo | set | messages: + msg138940 |
| 2011-01-28 20:31:40 | glyph | set | nosy:
lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord messages: + msg127340 |
| 2011-01-28 20:17:59 | barry | set | nosy:
lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord messages: + msg127336 |
| 2011-01-28 17:27:36 | eric.araujo | set | assignee: eric.araujo versions: + Python 3.3, - Python 3.2 messages: + msg127320 nosy: lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord |
| 2011-01-28 02:05:15 | glyph | set | nosy:
lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord messages: + msg127241 |
| 2010-08-13 21:01:57 | michael.foord | set | messages: + msg113830 |
| 2010-08-12 01:10:22 | eric.araujo | set | versions:
- Python 2.6, Python 2.5, Python 3.1, Python 2.7 nosy: lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord title: unify pydistutils.cfg and distutils.cfg and use .local -> Define a standard location and API for configuration files messages: + msg113646 assignee: tarek -> (no value) components: + Library (Lib), - Distutils2 |
| 2010-08-11 05:03:41 | eric.araujo | set | nosy:
lemburg, barry, georg.brandl, doko, ronaldoussoren, pitrou, tarek, fwierzbicki, ned.deily, glyph, eric.araujo, r.david.murray, michael.foord messages: + msg113588 components: + Distutils2, - Distutils versions: + Python 2.6, Python 2.5, Python 3.1 |
| 2010-08-02 05:33:05 | glyph | set | nosy:
+ glyph messages: + msg112423 |
| 2010-08-01 23:57:16 | michael.foord | set | messages: + msg112407 |
| 2010-08-01 23:01:23 | eric.araujo | set | messages: + msg112399 |
| 2010-08-01 21:08:37 | eric.araujo | set | messages: + msg112385 |
| 2010-08-01 18:52:30 | michael.foord | set | messages: + msg112366 |
| 2009-11-06 03:10:43 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg94963 |
| 2009-10-28 20:11:44 | ronaldoussoren | set | messages: + msg94637 |
| 2009-10-28 19:19:52 | fwierzbicki | set | nosy:
+ fwierzbicki |
| 2009-10-28 10:24:18 | ned.deily | set | messages: + msg94623 |
| 2009-10-28 09:46:17 | lemburg | set | messages: + msg94622 |
| 2009-10-28 09:40:49 | ned.deily | set | nosy:
+ ronaldoussoren, ned.deily messages: + msg94620 |
| 2009-10-26 22:36:38 | michael.foord | set | messages: + msg94531 |
| 2009-10-26 22:35:36 | michael.foord | set | messages: + msg94530 |
| 2009-10-26 22:28:33 | georg.brandl | set | messages: + msg94527 |
| 2009-10-26 22:12:44 | michael.foord | set | messages: + msg94523 |
| 2009-10-26 22:04:26 | tarek | set | nosy:
+ doko, michael.foord messages: + msg94519 |
| 2009-10-26 21:06:56 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg94507 |
| 2009-10-24 12:56:43 | tarek | set | messages: + msg94412 |
| 2009-10-20 17:32:07 | lemburg | set | messages: + msg94293 |
| 2009-10-20 15:50:28 | tarek | set | nosy:
+ lemburg, barry messages: + msg94289 |
| 2009-10-20 15:37:34 | pitrou | set | messages: + msg94288 |
| 2009-10-20 15:21:10 | tarek | set | messages: + msg94287 |
| 2009-10-20 15:17:10 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg94285 |
| 2009-10-20 15:11:30 | pitrou | set | messages: + msg94284 |
| 2009-10-20 15:03:36 | pitrou | set | messages: + msg94282 |
| 2009-10-20 14:55:35 | tarek | set | type: enhancement messages: + msg94281 |
| 2009-10-20 14:39:51 | pitrou | set | nosy:
+ pitrou messages: + msg94279 |
| 2009-10-20 11:21:15 | tarek | create | |
