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

2010-08-13 Thread Tarek Ziadé
On Thu, Aug 12, 2010 at 11:48 PM, Nick Coghlan ncogh...@gmail.com wrote:
 2010/8/12 Éric Araujo mer...@netwok.org:
 Choosing an arbitrary location we think is good on every system is fine
 and non risky I think, as long as Python let the various distribution
 change those paths though configuration.

 Don’t you have a bootstrapping problem? How do you know where to look at
 the sysconfig file that tells where to look at config files?

Not if located in a place known/owned by the interpreter whatever the layout is.


 Personally, I'm not clear on what a separate syconfig.cfg file offers
 over clearly separating the directory configuration settings and
 continuing to have distributions patch sysconfig.py directly. The
 bootstrapping problem (which would encourage classifying synconfig.cfg
 as source code and placing it alongside syscongig.py) is a major part
 of that point of view.

Sure, sysconfig.cfg would be part of the distribution, and this is not
really different
from code from our core point of view.

But it seems more appealing to give the ability to change installation
locations
through configuration rather than by patching the code, because the latter
also implies that Python behaves differently when patched, and add more
maintenance burden for everybody.

For us for instance, it would be more comfortable to keep most content in
sysconfig private, so we can change them at ease without breaking distributions
that patches it. I would hate to have to do a deprecation cycle if we
change the way
sysconfig internally works.

A documented cfg file feels just more standard-ish to me for this.

Regards.
Tarek

-- 
Tarek Ziadé | http://ziade.org
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-13 Thread Barry Warsaw
On Aug 12, 2010, at 09:10 AM, Fred Drake wrote:

Perhaps user configuration belongs in ~/.local/, or ~/.local/python/
(with attendant Windows  Mac OS noises); I don't really care where it
lands, because right now we just have a mess.  Getting it right with
respect to Window's roaming notion and how people expect to work
with it is... unlikely.  Picking a place is better than not, so we
know where to find things.  But that's all it buys us.

I've missed most of this discussion while on vacation, but if ~/.local is
supposed to mirror /usr/local, then wouldn't a logical place for per-user
configuration files be ~/.local/etc/whatever.cfg?

-Barry


signature.asc
Description: PGP signature
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-13 Thread Fred Drake
On Fri, Aug 13, 2010 at 11:57 AM, Barry Warsaw ba...@python.org wrote:
 I've missed most of this discussion while on vacation, but if ~/.local is
 supposed to mirror /usr/local, then wouldn't a logical place for per-user
 configuration files be ~/.local/etc/whatever.cfg?

Maybe it is; I'd hope so.

The fd.o spec that describes ~/.local/share/ doesn't say anything
*else* about ~/.local/, though.  So our expansion of ~/.local/ is very
much our own.

My own ~/.local/ contains a bunch of gnomish desktop stuff in share/
and Python stuff in lib/, and that's it.

I'd be as happy as I'm going to be with configs in ~~/.local/etc/.
(Still going to be a grouchy old fart.)


  -Fred

--
Fred L. Drake, Jr.    fdrake at gmail.com
A storm broke loose in my mind.  --Albert Einstein
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-13 Thread Antoine Pitrou
On Fri, 13 Aug 2010 11:57:57 -0400
Barry Warsaw ba...@python.org wrote:

 On Aug 12, 2010, at 09:10 AM, Fred Drake wrote:
 
 Perhaps user configuration belongs in ~/.local/, or ~/.local/python/
 (with attendant Windows  Mac OS noises); I don't really care where it
 lands, because right now we just have a mess.  Getting it right with
 respect to Window's roaming notion and how people expect to work
 with it is... unlikely.  Picking a place is better than not, so we
 know where to find things.  But that's all it buys us.
 
 I've missed most of this discussion while on vacation, but if ~/.local is
 supposed to mirror /usr/local, then wouldn't a logical place for per-user
 configuration files be ~/.local/etc/whatever.cfg?

I think this has already been debated, -1 on it.

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-13 Thread Michael Foord

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.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-13 Thread Tim Golden

On 13/08/2010 10:02 PM, Michael Foord wrote:

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:


Well, see my post early on in the thread about the
various senses of user directory under Windows.
The addition of expanduser to include Windows caused
a long debate at the time.  (ISTR)

I'm not really all that bothered for this purpose.
There's something to be said for all the suggestions
so far. However, as I've said elsewhere, I'm more
concerned that whatever we end up choosing for
location(s) be clearly documented as such.

TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tarek Ziadé
On Thu, Aug 12, 2010 at 7:00 AM, Russell E. Owen ro...@uw.edu wrote:
...

 If the files are shared among all users then /usr/local/something
 seems more reasonable.

 I also think whatever you choose for linux is also the best choice for
 Mac OS X (my preferred platform). While there are other possible
 directories, such as ~/Library/Application Support/something, all
 tools derived from unix that I know about use the unix convention (ssh,
 X11, bash...) and I would argue that Python is close enough to count
 even though it is a framework build. Put another way, copying the unix
 convention is simple, is exactly what power users would expect and I
 don't see it would do any harm.

Choosing an arbitrary location we think is good on every system is fine
and non risky I think, as long as Python let the various distribution
change those paths though configuration.

In fact, that's one of the future goal of the sysconfig module I had in mind.

Instead of having it reading paths from python variables, I would like
to introduce
a configuration file global to Python containing all the installation paths, and
the paths we are currently discussing.

That file could then be changed by distributions depending on their layouts.

It will avoid distributions to hack Python to change those paths.
For instance, Ubuntu currently patches distutils to change the
installation paths.

So let's:

- define all the default locations for each system
- define a sysconfig.cfg file that contains all installation paths,
for each target system
- change sysconfig.py so it uses it, instead of the global dicts it
currently has


Regards
Tarek

-- 
Tarek Ziadé | http://ziade.org
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tim Golden

On 11/08/2010 16:22, Éric Araujo wrote:

It would be nice to define one standard location for config files used
by stdlib modules, and maybe also by third-party programs related
closely to Python development (testing tools, static code checkers and
the like), in a way that doesn’t clutter the user home directory with a
dozen dotfiles while still being easily found.

(The Unix notions of dotfiles and home directory have to be adapted to
use non-dotfiles in some standard place on various Windows. The Mac
experts disagree on the right directory to use.)


The canonical place on Windows (per Microsoft [1]) is:

for roaming data: the Application Data folder (exposed as the
APPDATA env var and as CSIDL_APPDATA pre-Vista and the
FOLDERID_RoamingAppData Known Folder on Vista+).

for non-roaming data: the local app data (CSIDL_LOCAL_APPDATA
or FOLDERID_LocalAppData)

The obvious difference is whether a user expects the data to be
available for the same account on a different computer. At present,
the user site packages are held under %APPDATA%\Python\Pythonxx,
ie are considered roaming.

Unfortunately, the canonical place is not always the place most
used. Especially since the convention under *nix is to place dotfile
or dotdirs under $HOME. Windows doesn't, by default, have a $HOME so
various locations are considered $HOME, including (but not limited
to):

* the directory pointed to by %HOME%
* the directory pointed to by %USERPROFILE%
* the My Documents shell folder
  (often, but not always, %USERPROFILE%\My Documents)
* c:\ (no: really)
* the NT profile home directory (typically a mapped share)

Dotfiles are possible on Windows; the issue is that they can't
be created within the shell (ie within Windows Explorer). They
can be renamed, edited, etc without issue, so it's not much of
a problem. They can be created by any program which can call
CreateFile -- including Python, obviously.

TJG

[1] http://support.microsoft.com/kb/310294
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Steve Holden
On 8/12/2010 5:50 AM, Tim Golden wrote:
 On 11/08/2010 16:22, Éric Araujo wrote:
 It would be nice to define one standard location for config files used
 by stdlib modules, and maybe also by third-party programs related
 closely to Python development (testing tools, static code checkers and
 the like), in a way that doesn’t clutter the user home directory with a
 dozen dotfiles while still being easily found.

 (The Unix notions of dotfiles and home directory have to be adapted to
 use non-dotfiles in some standard place on various Windows. The Mac
 experts disagree on the right directory to use.)
 
 The canonical place on Windows (per Microsoft [1]) is:
 
 for roaming data: the Application Data folder (exposed as the
 APPDATA env var and as CSIDL_APPDATA pre-Vista and the
 FOLDERID_RoamingAppData Known Folder on Vista+).
 
 for non-roaming data: the local app data (CSIDL_LOCAL_APPDATA
 or FOLDERID_LocalAppData)
 
 The obvious difference is whether a user expects the data to be
 available for the same account on a different computer. At present,
 the user site packages are held under %APPDATA%\Python\Pythonxx,
 ie are considered roaming.
 
 Unfortunately, the canonical place is not always the place most
 used. Especially since the convention under *nix is to place dotfile
 or dotdirs under $HOME. Windows doesn't, by default, have a $HOME so
 various locations are considered $HOME, including (but not limited
 to):
 
 * the directory pointed to by %HOME%
 * the directory pointed to by %USERPROFILE%
 * the My Documents shell folder
   (often, but not always, %USERPROFILE%\My Documents)
 * c:\ (no: really)
 * the NT profile home directory (typically a mapped share)
 
 Dotfiles are possible on Windows; the issue is that they can't
 be created within the shell (ie within Windows Explorer). They
 can be renamed, edited, etc without issue, so it's not much of
 a problem. They can be created by any program which can call
 CreateFile -- including Python, obviously.
 
 TJG
 
 [1] http://support.microsoft.com/kb/310294

Didn't we have this discussion when per-user libraries came up?
Shouldn't we be using a subdirectory of that location? We ruin the risk
of Python becoming distributed so finely it becomes impossible to change
things, what with per-user libraries, per-version shared binaries,
per-user-per-version library configuration files and the rest.

One might make a case that all configuration data should be stored in a
single SQLite database (with a suitable API to hide the relational
nature of the store). Then at least there would only be one file no
matter how many versions of Python were installed. Seriously. We are
already spending enough time doing stat calls on non-existent directories.

regards
 Steve

PS: Then we can start putting the libraries themselves in the database.
That works really well.
-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
DjangoCon US September 7-9, 2010http://djangocon.us/
See Python Video!   http://python.mirocommunity.org/
Holden Web LLC http://www.holdenweb.com/

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tim Golden

On 12/08/2010 11:18, Steve Holden wrote:

On 8/12/2010 5:50 AM, Tim Golden wrote:


[... snip explanation of standard  non-standard locations ...]


Didn't we have this discussion when per-user libraries came up?
Shouldn't we be using a subdirectory of that location?


Yes we should. My explanation above was really just painting the
picture. It should have been an Appendix for the Truly Interested.


One might make a case that all configuration data should be stored in a
single SQLite database (with a suitable API to hide the relational
nature of the store). Then at least there would only be one file no
matter how many versions of Python were installed. Seriously. We are
already spending enough time doing stat calls on non-existent directories.


-1 on this. I don't care how many stats we're doing; I want to be able
to see my configuration / libraries etc without firing up a sqlite
session.

TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tim Golden

On 12/08/2010 10:50, Tim Golden wrote:

Unfortunately, the canonical place is not always the place most
used. Especially since the convention under *nix is to place dotfile
or dotdirs under $HOME. Windows doesn't, by default, have a $HOME so
various locations are considered $HOME, including (but not limited
to):

* the directory pointed to by %HOME%
* the directory pointed to by %USERPROFILE%
* the My Documents shell folder
(often, but not always, %USERPROFILE%\My Documents)
* c:\ (no: really)
* the NT profile home directory (typically a mapped share)


Additionally, on Windows Python expands ~ to the first of:

%HOME%
%USERPROFILE%
%HOMEDRIVE%\%HOMEPATH%

all of which are perfectly defensible defintions of Home on
Windows. But combining that with the Unix-minded concept of
create a dotfile called ~/.myapp means you get dotapps in
non-standard places on Windows.

TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Michael Foord

On 12/08/2010 11:18, Steve Holden wrote:

On 8/12/2010 5:50 AM, Tim Golden wrote:
   

On 11/08/2010 16:22, Éric Araujo wrote:
 

It would be nice to define one standard location for config files used
by stdlib modules, and maybe also by third-party programs related
closely to Python development (testing tools, static code checkers and
the like), in a way that doesn’t clutter the user home directory with a
dozen dotfiles while still being easily found.

(The Unix notions of dotfiles and home directory have to be adapted to
use non-dotfiles in some standard place on various Windows. The Mac
experts disagree on the right directory to use.)
   

The canonical place on Windows (per Microsoft [1]) is:

for roaming data: the Application Data folder (exposed as the
APPDATA env var and as CSIDL_APPDATA pre-Vista and the
FOLDERID_RoamingAppData Known Folder on Vista+).

for non-roaming data: the local app data (CSIDL_LOCAL_APPDATA
or FOLDERID_LocalAppData)

The obvious difference is whether a user expects the data to be
available for the same account on a different computer. At present,
the user site packages are held under %APPDATA%\Python\Pythonxx,
ie are considered roaming.

Unfortunately, the canonical place is not always the place most
used. Especially since the convention under *nix is to place dotfile
or dotdirs under $HOME. Windows doesn't, by default, have a $HOME so
various locations are considered $HOME, including (but not limited
to):

* the directory pointed to by %HOME%
* the directory pointed to by %USERPROFILE%
* the My Documents shell folder
   (often, but not always, %USERPROFILE%\My Documents)
* c:\ (no: really)
* the NT profile home directory (typically a mapped share)

Dotfiles are possible on Windows; the issue is that they can't
be created within the shell (ie within Windows Explorer). They
can be renamed, edited, etc without issue, so it's not much of
a problem. They can be created by any program which can call
CreateFile -- including Python, obviously.

TJG

[1] http://support.microsoft.com/kb/310294
 

Didn't we have this discussion when per-user libraries came up?
Shouldn't we be using a subdirectory of that location? We ruin the risk
of Python becoming distributed so finely it becomes impossible to change
things, what with per-user libraries, per-version shared binaries,
per-user-per-version library configuration files and the rest.

   


User editable configuration files are very different from libraries. The 
per user site-packages folder *should* be hidden somewhere out of the 
way where you can get at them if you want them but won't stumble across 
them all the time. e.g. AppData on Windows.


For files we expect the user to be able to edit we shouldn't go out of 
our way to make them hard or inconvenient to find.



One might make a case that all configuration data should be stored in a
single SQLite database (with a suitable API to hide the relational
nature of the store).
Yay - let's recreate the Windows registry! A binary blob only editable 
with special tools, we know how much users love that.



Michael


  Then at least there would only be one file no
matter how many versions of Python were installed. Seriously. We are
already spending enough time doing stat calls on non-existent directories.

regards
  Steve

PS: Then we can start putting the libraries themselves in the database.
That works really well.
   



--
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.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tim Golden

On 12/08/2010 11:40, Michael Foord wrote:

User editable configuration files are very different from libraries. The
per user site-packages folder *should* be hidden somewhere out of the
way where you can get at them if you want them but won't stumble across
them all the time. e.g. AppData on Windows.

For files we expect the user to be able to edit we shouldn't go out of
our way to make them hard or inconvenient to find.


This really comes down -- as with the Mac discussion last week, I
think -- to the tension between standard file locations and easy-to-get-to.
The difference on Windows, though, is that while on Mac it's either:
Apple standard /This/That/TheOther vs Unix standard $HOME/.something
on Windows it's %APPDATA%\myprog vs whatever-I-thought-of-at-the-time.

APPDATA isn't actually that hard to get to on any version of Windows
post 2000. (Just stick %APPDATA% into any Explorer window -- even
IE, for goodness sake). Even from the command line it's not hard:

notepad %APPDATA%\python\python26\idle.ini

Ultimately, as a Windows user/developer, I'd vote for a memorable
consistency, which for me would be %APPDATA%\python\... If everything's
in one place, I'll just create a shortcut / hardlink / whatever to get
me there when I want to change things.

TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Michael Foord

On 12/08/2010 11:54, Tim Golden wrote:

On 12/08/2010 11:40, Michael Foord wrote:

User editable configuration files are very different from libraries. The
per user site-packages folder *should* be hidden somewhere out of the
way where you can get at them if you want them but won't stumble across
them all the time. e.g. AppData on Windows.

For files we expect the user to be able to edit we shouldn't go out of
our way to make them hard or inconvenient to find.


This really comes down -- as with the Mac discussion last week, I
think -- to the tension between standard file locations and 
easy-to-get-to.

The difference on Windows, though, is that while on Mac it's either:
Apple standard /This/That/TheOther vs Unix standard $HOME/.something
on Windows it's %APPDATA%\myprog vs whatever-I-thought-of-at-the-time.

APPDATA isn't actually that hard to get to on any version of Windows
post 2000. (Just stick %APPDATA% into any Explorer window -- even
IE, for goodness sake). Even from the command line it's not hard:

notepad %APPDATA%\python\python26\idle.ini

Ultimately, as a Windows user/developer, I'd vote for a memorable
consistency, which for me would be %APPDATA%\python\... If everything's
in one place, I'll just create a shortcut / hardlink / whatever to get
me there when I want to change things.



How is ~/python not memorable or consistent? (And cross-platform 
memorability and consistency is valuable too.)


Another issue is discoverability. Many users won't know about these 
config files unless they *see* them. Sure if you *know* where they are 
then editing them is easy - but how often as a user do you browse your 
AppData folder? (As a windows user the only times I went delving in this 
mysterious location was trying to diagnose obscure errors.)


I'm not aware of any consistent pattern of putting *user editable* files 
in AppData, and I doubt this is where most users would look for them. 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? If we were to 
provide native GUI tools for editing values then the location suggested 
by Ronald for the Mac (which is the standard location for preferences 
files maintained by GUI tools) would also be the right location.


All the best,

Michael



TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk 




--
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.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Tim Golden

On 12/08/2010 12:17, Michael Foord wrote:


How is ~/python not memorable or consistent? (And cross-platform
memorability and consistency is valuable too.)


I was thinking outside Python rather than inside it (where ~ has no
meaning on Windows) but you make a good point here. If we were just
discussing Python code this would effectively be a winning point IMO.


Another issue is discoverability. Many users won't know about these
config files unless they *see* them.


While I sympathise with this, I'm not sure how much weight
one should give it in the context of this discussion. In the Unix
world, if I were guessing, I would justifiably look in
~/.myapp followed perhaps by /etc/myapp. On Windows, I might go
for the registry, as you mention elsewhere, and look in
HKLM\Software\MyApp but for actual files I'm not sure where
discoverable would be.

re: using the Registry: To be honest, I was answering the literal
question posed by Eric: where to put config files? Not the wider
question: how should config data be stored? Where the answer to
the latter question might be: the Registry -- much as I find it
awkward to work with at times.

One very definite point in its favour as regards this discussion
is that Python on Windows *already* defines a key in the Registry
(and has done so since v2.0 at least) and it would make some sense
to place things under there.

Ultimately, I don't feel very strongly about this subject. I'm more
concerned that the chosen location (file or registry or whatever) be
documented -- and documented from a Windows perspective as well, so
you don't have to guess what HOME means in this context.


TJG
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Éric Araujo
 If the files are shared among all users then /usr/local/something
 seems more reasonable.

Oh, right, I forgot to think about system-wide config files. They have
to be supported by another function in site.

A lot of programs have similar-looking code to get a list of filenames
and then process it with configparser or something else:
find_config_files in Distutils, get_standard_config_files in Docutils,
rcpath in Mercurial. There are different namings to support (rc, .cfg,
.conf, etc.) and also config directories (for Mercurial), but it does
not seem impossible to define a standard function that would benefit
Python itself and other programs.

 Choosing an arbitrary location we think is good on every system is fine
 and non risky I think, as long as Python let the various distribution
 change those paths though configuration.

Don’t you have a bootstrapping problem? How do you know where to look at
the sysconfig file that tells where to look at config files?

 In fact, that's one of the future goal of the sysconfig module I had in mind.

Seems great.

 So let's:
 
 - define all the default locations for each system
 - define a sysconfig.cfg file that contains all installation paths,
 for each target system
 - change sysconfig.py so it uses it, instead of the global dicts it
 currently has

I wonder if this is so complex that a wiki page or something else would
be better suited than email to iron out the proposal. Or maybe it’s time
for that sysconfig.cfg PEP you planned to do.

Regards

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Éric Araujo
Le 12/08/2010 12:18, Steve Holden a écrit :
 Didn't we have this discussion when per-user libraries came up?
 Shouldn't we be using a subdirectory of that location?

As pointed out by Antoine, Georg, Michael and I, the PEP 370 directory
for user site-packages is not the right place to put config files.

 PS: Then we can start putting the libraries themselves in the database.
 That works really well.

I don’t know you well enough to tell if this is the final hint that you
were sarcastic.

Regards

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Paul Moore
On 12 August 2010 12:59, Tim Golden m...@timgolden.me.uk wrote:
 re: using the Registry: To be honest, I was answering the literal
 question posed by Eric: where to put config files? Not the wider
 question: how should config data be stored? Where the answer to
 the latter question might be: the Registry -- much as I find it
 awkward to work with at times.

 One very definite point in its favour as regards this discussion
 is that Python on Windows *already* defines a key in the Registry
 (and has done so since v2.0 at least) and it would make some sense
 to place things under there.

 Ultimately, I don't feel very strongly about this subject. I'm more
 concerned that the chosen location (file or registry or whatever) be
 documented -- and documented from a Windows perspective as well, so
 you don't have to guess what HOME means in this context.

One potential solution would be to use something like
os.path.expanduser(~/.python), where os.path.expanduser has a
defined behaviour on Windows (one that could do with a little
clarification, yes I know, doc patch welcomed...), but also add an
additional option, that os.path.expanduser will first look in the
registry for the value HKLM\Software\Python\PythonCore\HOME and use
that if present. Then users could set their own interpretation, in a
Windows-standard manner.

If that would be an acceptable option, I could supply a patch to
os.path.expanduser. I will do a clarifying doc patch regardless.

Paul.

PS We could also support ~user by looking in HKEY_USERS\user
SID\Software\Python\... but that's probably YAGNI :-)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Fred Drake
On Thu, Aug 12, 2010 at 6:18 AM, Steve Holden st...@holdenweb.com wrote:
 Didn't we have this discussion when per-user libraries came up?
 Shouldn't we be using a subdirectory of that location? We ruin the risk
 of Python becoming distributed so finely it becomes impossible to change
 things, what with per-user libraries, per-version shared binaries,
 per-user-per-version library configuration files and the rest.

Yes, we did.  That was in the context of some people's desire for a
per-user site-packages directory, and the result is that we're now
saddled with a per-user site-packages directory.

The structure determined there was the same sort of half-way
version-specific mess as so many others are: libraries are
per-python-version, and scripts are installed cowboy-style (whoever
got there last, wins).

Perhaps user configuration belongs in ~/.local/, or ~/.local/python/
(with attendant Windows  Mac OS noises); I don't really care where it
lands, because right now we just have a mess.  Getting it right with
respect to Window's roaming notion and how people expect to work
with it is... unlikely.  Picking a place is better than not, so we
know where to find things.  But that's all it buys us.


  -Fred

--
Fred L. Drake, Jr.    fdrake at gmail.com
A storm broke loose in my mind.  --Albert Einstein
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Michael Foord

On 12/08/2010 08:26, Tarek Ziadé wrote:

[snip...]
Choosing an arbitrary location we think is good on every system is fine
and non risky I think, as long as Python let the various distribution
change those paths though configuration.

In fact, that's one of the future goal of the sysconfig module I had in mind.

Instead of having it reading paths from python variables, I would like
to introduce
a configuration file global to Python containing all the installation paths, and
the paths we are currently discussing.

That file could then be changed by distributions depending on their layouts.

   


Yes - this sounds good. +1 It also provides a single place for users who 
are unhappy with the defaults that we choose.


Michael


It will avoid distributions to hack Python to change those paths.
For instance, Ubuntu currently patches distutils to change the
installation paths.

So let's:

- define all the default locations for each system
- define a sysconfig.cfg file that contains all installation paths,
for each target system
- change sysconfig.py so it uses it, instead of the global dicts it
currently has


Regards
Tarek

   



--
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.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Nick Coghlan
2010/8/12 Éric Araujo mer...@netwok.org:
 Choosing an arbitrary location we think is good on every system is fine
 and non risky I think, as long as Python let the various distribution
 change those paths though configuration.

 Don’t you have a bootstrapping problem? How do you know where to look at
 the sysconfig file that tells where to look at config files?

Personally, I'm not clear on what a separate syconfig.cfg file offers
over clearly separating the directory configuration settings and
continuing to have distributions patch sysconfig.py directly. The
bootstrapping problem (which would encourage classifying synconfig.cfg
as source code and placing it alongside syscongig.py) is a major part
of that point of view.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Glyph Lefkowitz

On Aug 12, 2010, at 6:30 AM, Tim Golden wrote:

 I don't care how many stats we're doing

You might not, but I certainly do.  And I can guarantee you that the authors of 
command-line tools that have to start up in under ten seconds, for example 
'bzr', care too.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Antoine Pitrou
On Thu, 12 Aug 2010 18:14:44 -0400
Glyph Lefkowitz gl...@twistedmatrix.com wrote:
 
 On Aug 12, 2010, at 6:30 AM, Tim Golden wrote:
 
  I don't care how many stats we're doing
 
 You might not, but I certainly do.  And I can guarantee you that the
 authors of command-line tools that have to start up in under ten
 seconds, for example 'bzr', care too.

The idea that import time is dominated by stat() calls sounds rather
undemonstrated (and unlikely) to me.

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Steven D'Aprano
On Thu, 12 Aug 2010 08:18:27 pm Steve Holden wrote:
 One might make a case that all configuration data should be stored in
 a single SQLite database (with a suitable API to hide the relational
 nature of the store).

-1

Please don't even *consider* such a thing. Haven't we learned from 
Firefox? I for one am getting heartily sick and tired of having 
to fix (that is, throw away) corrupted Firefox databases. Please 
don't go down that path.


-- 
Steven D'Aprano
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Toshio Kuratomi
On Fri, Aug 13, 2010 at 07:48:22AM +1000, Nick Coghlan wrote:
 2010/8/12 Éric Araujo mer...@netwok.org:
  Choosing an arbitrary location we think is good on every system is fine
  and non risky I think, as long as Python let the various distribution
  change those paths though configuration.
 
  Don’t you have a bootstrapping problem? How do you know where to look at
  the sysconfig file that tells where to look at config files?

I'd hardcode a list of locations.
  [os.path.join(os.path.dirname(__file__), 'sysconfig.cfg'),
   os.path.join('/etc', 'sysconfig.cfg')]

The distributor has a limited choice of options on where to look.

A good alternative would be to make the config file overridable.  That way
you can have sysconfig.cfg next to sysconfig.py or in a known config
directory relative to the python stdlib install but also let the
distributions and individual sites override the defaults by making changes
to /etc/python3/sysconfig.cfg for instance.

 
 Personally, I'm not clear on what a separate syconfig.cfg file offers
 over clearly separating the directory configuration settings and
 continuing to have distributions patch sysconfig.py directly. The
 bootstrapping problem (which would encourage classifying synconfig.cfg
 as source code and placing it alongside syscongig.py) is a major part
 of that point of view.
 
Here's some advantages but some of them are of dubious worth:

* Allows users/site-administrators to change paths and not have packaging
  systems overwrite the changes.
* Makes it conceptually cleaner to make this overridable via user defined
  config files since  it's now a matter of parsing several config files
  instead of having a hardcoded value in the file and overridable values
  outside of it.
* Allows sites to add additional paths to the config file.
* Makes it clear to distributions that the values in the config file are
  available for making changes to rather than having to look for it in code
  and not know the difference between thaat or say, the encoding parameter
  in python2.
* Documents the format to use for overriding the paths if individual sites
  can override the defaults that are shipped in the system version of
  python.

-Toshio


pgpBEZ2XsDBy9.pgp
Description: PGP signature
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Éric Araujo
 A good alternative would be to make the config file overridable.  That way
 you can have sysconfig.cfg next to sysconfig.py or in a known config
 directory relative to the python stdlib install but also let the
 distributions and individual sites override the defaults by making changes
 to /etc/python3/sysconfig.cfg for instance.

Putting configuration files next to source code does not agree with the
FHS. Your message gave me an idea though: Some function could be called
in sitecustomize (symlinked from /etc on Debian e.g.) to set the path to
sysconfig.cfg.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread David Cournapeau
On Fri, Aug 13, 2010 at 7:29 AM, Antoine Pitrou solip...@pitrou.net wrote:
 On Thu, 12 Aug 2010 18:14:44 -0400
 Glyph Lefkowitz gl...@twistedmatrix.com wrote:

 On Aug 12, 2010, at 6:30 AM, Tim Golden wrote:

  I don't care how many stats we're doing

 You might not, but I certainly do.  And I can guarantee you that the
 authors of command-line tools that have to start up in under ten
 seconds, for example 'bzr', care too.

 The idea that import time is dominated by stat() calls sounds rather
 undemonstrated (and unlikely) to me.

It may be, depending on what you import. I certainly have seen (and
profiled) it. In my experience, stat calls and regex compilation often
come at the top of the culprits for slow imports. In the case of
setuptools namespace package, there was a thread on 23rd april on
distutils-sig about this issue: most of the slowdown came from
unneeded stat (and symlink translations).

cheers,

David
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-12 Thread Stephen J. Turnbull
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?  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.

  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



___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Éric Araujo
Hello list

Tarek opened a distutils bugs in http://bugs.python.org/issue7175 that
evolved into a discussion about the proper location to use for config files.

Distutils uses [.]pydistutils.cfg and .pypirc, and now unittest2 has a
config file too.

It would be nice to define one standard location for config files used
by stdlib modules, and maybe also by third-party programs related
closely to Python development (testing tools, static code checkers and
the like), in a way that doesn’t clutter the user home directory with a
dozen dotfiles while still being easily found.

(The Unix notions of dotfiles and home directory have to be adapted to
use non-dotfiles in some standard place on various Windows. The Mac
experts disagree on the right directory to use.)

Tarek, Antoine, RDM, MAL were +1 on using ~/.python (whether to use
.pythonx.y or .python/x.y is a subissue to discuss after general agreement).

What do you think about this?

Regards

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Michael Foord

On 11/08/2010 16:22, Éric Araujo wrote:

Hello list

Tarek opened a distutils bugs in http://bugs.python.org/issue7175 that
evolved into a discussion about the proper location to use for config files.

Distutils uses [.]pydistutils.cfg and .pypirc, and now unittest2 has a
config file too.
   


IDLE has a config directory too - currently .idlerc in ~ (on Mac OS X at 
any rate).


Michael


It would be nice to define one standard location for config files used
by stdlib modules, and maybe also by third-party programs related
closely to Python development (testing tools, static code checkers and
the like), in a way that doesn’t clutter the user home directory with a
dozen dotfiles while still being easily found.

(The Unix notions of dotfiles and home directory have to be adapted to
use non-dotfiles in some standard place on various Windows. The Mac
experts disagree on the right directory to use.)

Tarek, Antoine, RDM, MAL were +1 on using ~/.python (whether to use
.pythonx.y or .python/x.y is a subissue to discuss after general agreement).

What do you think about this?

Regards

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
   



--
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.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Fred Drake
On Wed, Aug 11, 2010 at 11:22 AM, Éric Araujo mer...@netwok.org wrote:
 Tarek, Antoine, RDM, MAL were +1 on using ~/.python (whether to use
 .pythonx.y or .python/x.y is a subissue to discuss after general agreement).

+0.5

I'd like to see a more complete proposal, including:

- what to do with Windows, Mac OS X

- backward compatibility considered
  (seems straightforward, but seemings are often wrong)

- cross-platform API to locate these files
  (should be able to address the b/w compat issues)

Seems like a good idea to have a registry of files known to be placed there
(a wiki page should be sufficient; if the API is used to create the directory,
it can drop in a README.txt pointing to that page).


  -Fred

--
Fred L. Drake, Jr.    fdrake at gmail.com
A storm broke loose in my mind.  --Albert Einstein
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Adal Chiriliuc
Hello,

Fred Drake fdrake at acm.org wrote:
 +0.5

 I'd like to see a more complete proposal, including:

 - what to do with Windows, Mac OS X

PEP 370 already specifies a directory for Python config files:

 user data directory

 Usually the parent directory of the user site directory. It's meant for 
 Python version specific data like config files, docs,  images and 
 translations.

 Unix (including Mac)
 ~/.local/lib/python2.6
 Windows
 %APPDATA%/Python/Python26

Regards
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Éric Araujo
 I'd like to see a more complete proposal, including:
Fair enough.

tl;dr: Locating config files is hard.

I have looked at http://github.com/ActiveState/appdirs (MIT) for
OS-specific bits of knowledge. (Note that the directories it uses for
free OSes are not compliant with the freedesktop.org Base Directory
specification, which already did the reflexion and code to separate
config, user data and cache.)

 - what to do with Windows,
appdirs uses pywin32 or ctypes or _winreg to find the correct value for
the user settings directory. There is a new complication in recent
Windows called roaming profiles, which are copied from a server to
multiple clients and need synchronization calls.

 Mac OS X
There is debate between Ned Deily, Ronald Oussoren and Glyph Lefkowitz
as to whether Mac OS is just a Unix or a special beast. appdirs chooses
the Mac-specific directory. There are also probably variations between
system installations, framework things and unix-style installations.

 - backward compatibility considered
   (seems straightforward, but seemings are often wrong)
Are you talking about finding config from older locations, or automatic
renaming of ~/.idlerc to ~/.python/idlerc? The former seems easy; not
sure how to do the latter. Gajim, a PyGTK Jabber client, moved from a
custom layout to BaseDir-compliant directories a few months ago; I think
it looks for the old directories on every startup to see if they need to
be moved. I’m not sure if this affects startup time noticeably, since
it’s after all a graphical network Python app, but it may be a concern
with programs that are run a lot like the unittest2 script (or not,
considering startup time of the interpreter).

 - cross-platform API to locate these files
I was thinking about adding a function to site with this tentative
signature:

def getuserconfig(appname=''):
Return the configuration file name for `appname`.

If `appname` is the empty string, return the directory used for
Python configuration files, else returns the file name used for the
configuration file of `appname` (a PyPI project name).

Strings starting with a number ('3.2') are reserved by Python.


I’m not sure the x.y subdirectory is necessary. distutils config files
are compatible since forever and will still be compatible with
distutils2; config files in unittest2 are very recent, they could have a
policy of compatiblity too; I can investigate IDLE config format.

A boolean could control whether to return filenames using the old
conventions. On Windows, this would need application name and
author/vendor name (settings are grouped by author). On Mac, the
application would have to say whether it uses a unix-style dotfile or a
Mac-style directory. Also, capitalization differs across OSes. Can of
worms here.

 Seems like a good idea to have a registry of files known to be placed there
The project name registration on PyPI may be enough to avoid duplicates.


Next steps:

1) Find out if winreg is reliable enough, since we don’t want to depend
on ctypes or pywin32 IIRC.

2) Have the Mac people come to an agreement for each type of install.

3) Prototype the new function. It’s probably a good idea to contact the
author of appdirs and work with him on a Python-specific subset of his
module instead of rewriting the same code.

4) Think about the best way to handle b/w compat. Timings could help
deciding for or against automatic renaming.


Thanks for the feedback.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Éric Araujo
 PEP 370 already specifies a directory for Python config files:
 
 user data directory

 Usually the parent directory of the user site directory.
 It's meant for Python version specific data like config
 files, docs, images and translations.

Thanks for pointing that. However, I have to disagree with the PEP here:
config files are not data files. Considering the FHS or the XDG Base
Directory specifications, there is a precedent in distinguishing user
config (edited by the user through a text editor or settings graphical
window), program data (state) and cache (files for speedups that can
safely be deleted).

Regards

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Fred Drake
On Wed, Aug 11, 2010 at 10:58 PM, Éric Araujo mer...@netwok.org wrote:
 Considering the FHS or the XDG Base
 Directory specifications, there is a precedent in distinguishing user
 config (edited by the user through a text editor or settings graphical
 window), program data (state) and cache (files for speedups that can
 safely be deleted).

Right.  The wording in that PEP is ambiguous at best, but the
inclusion of the Python version number in the listed path suggests
that this is for automatically managed stat (like those trashy *.pth
files some tools worry about), not for something the human user is
going to manipulate directly.

That PEP is particularly concerned with package management per user (a
dodgy proposition at best), so everything there is about package
management tool support, not user-manipulated configuration data.


  -Fred

--
Fred L. Drake, Jr.    fdrake at gmail.com
A storm broke loose in my mind.  --Albert Einstein
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2010-08-11 Thread Russell E. Owen
In article 4c62c01d.6000...@netwok.org,
 Éric Araujo mer...@netwok.org wrote:

 Hello list
 
 Tarek opened a distutils bugs in http://bugs.python.org/issue7175 that
 evolved into a discussion about the proper location to use for config files.
 
 Distutils uses [.]pydistutils.cfg and .pypirc, and now unittest2 has a
 config file too.
 
 It would be nice to define one standard location for config files used
 by stdlib modules, and maybe also by third-party programs related
 closely to Python development (testing tools, static code checkers and
 the like), in a way that doesn’t clutter the user home directory with a
 dozen dotfiles while still being easily found.
 
 (The Unix notions of dotfiles and home directory have to be adapted to
 use non-dotfiles in some standard place on various Windows. The Mac
 experts disagree on the right directory to use.)
 
 Tarek, Antoine, RDM, MAL were +1 on using ~/.python (whether to use
 .pythonx.y or .python/x.y is a subissue to discuss after general agreement).
 
 What do you think about this?

I like the idea as long as different versions of python have different 
directories and the files are intended to be user-specific.

If the files are shared among all users then /usr/local/something 
seems more reasonable.

I also think whatever you choose for linux is also the best choice for 
Mac OS X (my preferred platform). While there are other possible 
directories, such as ~/Library/Application Support/something, all 
tools derived from unix that I know about use the unix convention (ssh, 
X11, bash...) and I would argue that Python is close enough to count 
even though it is a framework build. Put another way, copying the unix 
convention is simple, is exactly what power users would expect and I 
don't see it would do any harm.

-- Russell

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com