On Sun, Feb 7, 2021 at 3:58 PM Inada Naoki <songofacandy@gmail.com> wrote:
> Chiefly, I don't want to overload "pyvenv.cfg" with new behavior
> that's unrelated to virtual environments.

This is my point -- this is NOT unrelated to virtual environments -- UTF-8 mode, and other configuration parameters are very much part of the (generic term) environment. The whole point here is to be able to set a configuration on a virtual environment. And I think that the venv tool should probably grow a feature to turn it on (or off).

So my take is that we have pyvenv.cfg already, so why not use it for all the configuration one might want for a particular "environment".

> I also dislike the way this file is found.
... 
 But this
> pattern is not safe in general when installed to an arbitrary
> directory, or with a portable distribution.

Indeed, that is unfortunate. And may well make this impossible -- I agree that a general configuration file shouldn't be found there. Oh well -- more config files it is!

OK, then, how about just same to python.exe?
In this case, we need to put python.ini in Scripts directory for venvs.
It seems a bit odd, but much simpler than looking in the parent directory.

I think that would work.

> The idea to use the profile data directories %ProgramData% and
> %LocalAppData% was for symmetry with how this could be supported in
> POSIX, which doesn't use the application directory as Windows does.

The issue (to me anyway) is not where is it, but rather the whole idea of putting it outside python, and in the user's space at all.

Should we support it in Unix? I don't think so.
Command-line and environment variables are easy to use on Unix.

maybe, but we have many of the same issues -- we want the configuration tied to the environment, not to the user and all environments. And I'd rather have things done the same way on all platforms, rather than the native way on each platform, if I have to make a choice. That is, if there is a way to configure Python on Windows, I'd really like the SAME way to be available on all platforms.
 
And beginners should use a UTF-8 locale.

Beginners may not know how to do that / have a choice.

This is a question I still don't know the answer to -- I think that most (all?) non Windows platforms currently supported use utf-8 -- but is that guaranteed? That is, might some platform come up that does need utf-8 mode? So why not have it available everywhere, even though it will be a no-op on most systems.

> The application "python.cfg" (in the directory of the executable,
> including a virtual environment) can support a setting to isolate it
> from system and user "python.cfg" files.

I know that. But I don't think it's enough reason to put a new config
file to user profile.
If users don't have system privilege, they can still install another Python.

exactly -- I"m trying to imagine a case where a user doesn't have read access to the place the python.exe is, but DOES need to override this one thing. That is, a user can either control the python install they are using or they can't.
 
Config file in user profile is fragile. If all venvs start using
profile directory, it become unmaintainable soon.

exactly -- if this is added, I will certianly not recommend anyone use it.
 
We can just recommend per-user install for new users.

or a virtual environment :-)

Thanks Eryk for bringing clarity to these issues.

-Chris B.

-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython