On Tue, Feb 2, 2021 at 11:12 AM Barry Scott <barry@barrys-emacs.org> wrote:
Where would Python look for a "configuration file like `pyvenv.cfg`" ?

I am not a Windows expert so I am not sure. But I think it should be
the same directory where `python.exe` is in.
A small note here -- ideally there would be nothing Windows specific here. Yes, UTF-8 mode is Windows only, but:

1) should it be? I'm still unsure on this, but while the vast majority of other platforms use UTF-8 -- maybe it would be more robust to have UTF-8 mode available everywhere -- essentially, ignore the "system encoding", no matter the system.

2) perhaps UTF-8 mode isn't the only use-case for this -- it would be good to have a way to have Python startup parameters that are installation / environment specific -- that could help with other issues with "global" configuration: PYTHONPATH, PYTHONHOME, PYTHONSTARTUP, other PYTHON* environment variables.

I'd suggest that you could have a %LOCALAPPDATA%\python.ini
But what happen if user installed Python from python.org and Python from conda?
User may have two or more Pythons having the same version.
and different environments, be they conda environments, pipenv, what have you.
 
Apple showed the way by using reversed FQD's.

Python.org would use org.python.python.ini
Conda.io would use io.conda.python.ini
barry-emacs.org's python would use org.barrys-emacs.python.python.ini

Further we would need to support multiple versions of python from the same org installed side-by-side.
Structure the .ini so that it has default settings and version specific settings.

This would be pretty painful to manage -- it's a "bad idea" to have a single configuration file that is being managed and updated by any number of different tools. And those tools are managed by different groups of people.

And this would be VERY hard for end users to manage -- as people installed and uninstalled python versions and environments, they would get a very, very messy global ini file.

Also: "conda python" is not necessarily any different than python.org python -- it's generally built exactly the same way -- the only difference is how it's installed.

So it would be much better for the config file to be located inside the Python installation: essentially a 1:1 relationship between the python executable and the config file. So you know for sure that if you fire up the python you are intending to, you will get the configuration that comes with it.
 
[3.8-64]
utf8-mode = false

The key issue here is that the configuration is not "version number specific" -- it's (or should be) application specific. And Python has had that issue for ages: as a run-time system (for lack of a better word), each application needs a different set of packages in various versions. And that's been addressed with with "environments" of various sorts. So it would be good to leverage that, and have a config file that goes right along with the environment systems: i.e. it's part of that particular Python install,

And ideally, it could be installed with pip somehow, so that an application could specify a python configuration along with its package specifications.

-CHB

-- 
Christopher Barker, PhD (Chris)

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