On Sun, Feb 7, 2021 at 4:16 PM Eryk Sun <eryk...@gmail.com> wrote: > > On 2/6/21, Christopher Barker <python...@gmail.com> wrote: > > On Sat, Feb 6, 2021 at 11:47 AM Eryk Sun <eryk...@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. >
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. > 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. > Thank you, I didn't know that. If we need to search a parent directory, we need to check ._pth too. > >> 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. > Should we support it in Unix? I don't think so. Command-line and environment variables are easy to use on Unix. And beginners should use a UTF-8 locale. > 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. Config file in user profile is fragile. If all venvs start using profile directory, it become unmaintainable soon. We can just recommend per-user install for new users. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/65TZSOWYHQI7KL2QCHQDRJQQUZDMTDPZ/ Code of Conduct: http://python.org/psf/codeofconduct/