
On 2/6/21, Christopher Barker pythonchb@gmail.com wrote:
On Sat, Feb 6, 2021 at 11:47 AM Eryk Sun eryksun@gmail.com wrote:
Relative to the installation, "python.cfg" should only be found in the same directory as the base executable, not its parent directory.
OK, my mistake — I thought that was already the case with pyvenv.cfg. Though I don’t get why it matters.
Chiefly, I don't want to overload "pyvenv.cfg" with new behavior that's unrelated to virtual environments.
I also dislike the way this file is found. If the parent directory is "C:\Program Files", then I'm not worried about finding "C:\Program Files\pyvenv.cfg" when the interpreter tries to open it. But this pattern is not safe in general when installed to an arbitrary directory, or with a portable distribution.
The presence of a "._pth" file (Windows only) beside the DLL or executable bypasses the search for "pyvenv.cfg", among other things. The embedded distribution includes a ._pth that locks it down. This is another reason to use a different file to configure defaults for -X settings such as "utf8", a file that's guaranteed to always be read.
Add an option in the installed "python.cfg" to set the name of the organization and application.
That would work for, e.g. pyinstaller (which I hope already ignores these kinds if configuration.
But not for, e.g. web applications that expect to use virtual environments to isolate themselves.
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 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.