Currently non-version-specific shims resolve versions with the ActivePythonVersions registry value, which can be manipulated with snafu use. The Py launcher, however, has its own config file (and environs). It can be confusing to users why py -3 and python3 can launch different versions.
Proposed solution to incorporate the launcher’s settings.
Shim all scripts.
Each script shim uses the following order to find a working Python version:
Use PY_PYTHON and defauts.python to find the major version (defaults to latest possible)
PY_PYTHONX and defaults.pythonX to find the minor version (replace X with the major version)
Check the installation root and the Scripts directory for that executable; if it exists, use it.
If 3. fails, fallback to the current version-resolution logic to find the best version for that script.
Error if scripts are found. (Shouldn’t happen unless user does something to corrupt the use and link results.)
snafu use <versions ...> would still write to the ActivePythonVersions registry, but would warn the user if there are overriding settings in either py.ini or environs. snafu use with no arguments show the value of ActivePythonVersions, but also displays warnings for overriding values.
snafu link only considers ActivePythonVersions. If the user overwrites the version for a certain script, that’s fine; if this results in the user not getting a script because its Python is not specified in ActivePythonVersions, the situation should be pretty easily debuggable.
Pretty difficult to get right, and arguably equally confusing. py.ini is not enough for our purposes, but there really isn’t a good way to sync multiple storages.
Currently non-version-specific shims resolve versions with the
ActivePythonVersions
registry value, which can be manipulated withsnafu use
. The Py launcher, however, has its own config file (and environs). It can be confusing to users whypy -3
andpython3
can launch different versions.Proposed solution to incorporate the launcher’s settings.
PY_PYTHON
anddefauts.python
to find the major version (defaults to latest possible)PY_PYTHONX
anddefaults.pythonX
to find the minor version (replaceX
with the major version)Scripts
directory for that executable; if it exists, use it.use
andlink
results.)snafu use <versions ...>
would still write to theActivePythonVersions
registry, but would warn the user if there are overriding settings in eitherpy.ini
or environs.snafu use
with no arguments show the value ofActivePythonVersions
, but also displays warnings for overriding values.snafu link
only considersActivePythonVersions
. If the user overwrites the version for a certain script, that’s fine; if this results in the user not getting a script because its Python is not specified inActivePythonVersions
, the situation should be pretty easily debuggable.