winget-pkgs icon indicating copy to clipboard operation
winget-pkgs copied to clipboard

[Package Request]: Python.Python.3.Latest

Open MarcoPeraza opened this issue 2 years ago • 5 comments

Hi, why are there only packages for specific versions of Python3 and no package that just installs the latest version? I recognize that Python2 and Python3 are different enough to not be interchangeable. But when I install Python3, I normally want the latest version of Python3, just like I want the latest version of Powershell when I install Powershell.

MarcoPeraza avatar Oct 20 '22 04:10 MarcoPeraza

all older python 3 are simply named "python 3". I think they should be renamed with also the .x (python 3.0/3.1/.....) like in the id. The only "python 3" should be the latest (3.10 now). Also, the 3.11 RC package doesn't exist. But before doing any pr I'd like to listen to other opinions and possible breaking changes...

TheBossMagnus avatar Oct 20 '22 07:10 TheBossMagnus

The PackageName should stay as Python 3 because that is what is written as the display name in Control Panel. Besides, even if it were changed, winget would still find all the subversions when searching for Python3. The best way to get winget install Python3 would be to change the moniker on the latest subpackage of Python3 to be python3, since winget treats an exact match with a moniker the same as an exact match for a package id. This does have the downfall of needing to be changed when new minor versions are released (e.g 3.10 -> 3.11) but it should work.

Regarding 3.11 not existing yet, I'm believe this is because it is not yet released to stable and is only a release candidate build.

Trenly avatar Oct 20 '22 12:10 Trenly

Regarding 3.11 not existing yet, I'm believe this is because it is not yet released to stable and is only a release candidate build. It's a good idea to make a package anyway(python 3.11 RC)?

TheBossMagnus avatar Oct 20 '22 14:10 TheBossMagnus

winget install python3 now should install the latest version

Trenly avatar Oct 20 '22 17:10 Trenly

I've a question: when python 3.11 is released, winget upgrade --all is gonna be able to update python 3.10 to 3.11?

ppvnf avatar Oct 20 '22 20:10 ppvnf

I'm not sure a moniker solves the problem. Packages are not guaranteed to have unique monikers, but they are guaranteed to have unique IDs. Like with other languages, it seems like there should be a package ID that always corresponds to the latest version of Python 3 in winget.

MarcoPeraza avatar Oct 22 '22 09:10 MarcoPeraza

At this moment, there is a problem about --id=Python.Python.3. it seems that Python.Python.3 is not pointed to the latest version of Python3, and latest Python3 is with --id=Python.Python.3.11. I tried to download Python3 with that cade and it doesn't work: winget install -e -i --id=Python.Python.3 --source=winget --scope=machine It says No package found matching input criteria..

NJT145 avatar Dec 28 '22 15:12 NJT145

At this moment, there is a problem about --id=Python.Python.3. it seems that Python.Python.3 is not pointed to the latest version of Python3, and latest Python3 is with --id=Python.Python.3.11. I tried to download Python3 with that cade and it doesn't work: winget install -e -i --id=Python.Python.3 --source=winget --scope=machine It says No package found matching input criteria..

This relies on a faulty assumption that a package with the id Python.Python.3 exists. The fact is that all of the Python 3 versions use the two part version. For example, running winget search --id Python.Python.3 results in the list of python packages available

PS C:\WINDOWS\system32> winget search --id Python.Python.3
Name        Id                 Version
---------------------------------------
Python 3    Python.Python.3.9  3.9.13
Python 3    Python.Python.3.8  3.8.10
Python 3    Python.Python.3.7  3.7.9
Python 3    Python.Python.3.6  3.6.8
Python 3    Python.Python.3.5  3.5.4
Python 3    Python.Python.3.4  3.4.4
Python 3    Python.Python.3.3  3.3.5
Python 3    Python.Python.3.2  3.2.5
Python 3    Python.Python.3.12 3.12.0a3
Python 3.11 Python.Python.3.11 3.11.1
Python 3    Python.Python.3.10 3.10.8
Python 3    Python.Python.3.1  3.1.4
Python 3    Python.Python.3.0  3.0.1

However, adding -e to search for the exact ID returns no results, because there is no package with the ID Python.Python.3

PS C:\WINDOWS\system32> winget search --id Python.Python.3 -e
No package found matching input criteria.

But, if you search for just python3

PS C:\WINDOWS\system32> winget search python3
Name        Id                  Version     Match
------------------------------------------------------------
Python 3.11 Python.Python.3.11  3.11.1      Moniker: python3
Miniconda3  Anaconda.Miniconda3 py39_4.10.3 Command: python3
Anaconda3   Anaconda.Anaconda3  2022.05     Command: python3
Python 3    Python.Python.3.9   3.9.13      Tag: python3
Python 3    Python.Python.3.8   3.8.10      Tag: python3
Python 3    Python.Python.3.7   3.7.9       Tag: python3
Python 3    Python.Python.3.6   3.6.8       Tag: python3
Python 3    Python.Python.3.5   3.5.4       Tag: python3
Python 3    Python.Python.3.4   3.4.4       Tag: python3
Python 3    Python.Python.3.3   3.3.5       Tag: python3
Python 3    Python.Python.3.2   3.2.5       Tag: python3
Python 3    Python.Python.3.12  3.12.0a3    Tag: python3
Python 3    Python.Python.3.10  3.10.8      Tag: python3
Python 3    Python.Python.3.1   3.1.4       Tag: python3
Python 3    Python.Python.3.0   3.0.1       Tag: python3

Since Python 3.11 has the Monker: python3, running winget install python3 --source winget --scope machine will download and install the latest version of Python 3.11

Trenly avatar Jan 04 '23 12:01 Trenly

@Trenly, even to the extent that works, isn't it fragile since winget install xyz is just a fuzzy match? By contrast, --id or --e let you specify an exact package. I don't want to fuzzy match for python3 and hope I get the latest version, I want to exactly specify that I want the latest version of Python3. Maybe I misunderstand how monikers work?

MarcoPeraza avatar Feb 01 '23 17:02 MarcoPeraza

@Trenly, even to the extent that works, isn't it fragile since winget install xyz is just a fuzzy match? By contrast, --id or --e let you specify an exact package. I don't want to fuzzy match for python3 and hope I get the latest version, I want to exactly specify that I want the latest version of Python3. Maybe I misunderstand how monikers work?

winget install is not a fuzzy match in the way you would think. Take for example AngusJohnson.ResourceHacker. If you run winget search resourcehacker then it will be found, but if you run winget install resourcehacker it will not be.

winget install uses a heuristic match to determine user intent. If there is a package where moniker is exactly equal to user input, that is considered an exact match for install. If there isn't an exact match by moniker, next would be an exact match on the package Name, ID, or product code. If there isn't an exact match, then there are additional queries that try to determine if there is a single package matching the query, although I'm not super familiar with them.

The way --id works is that it restricts matching on that specific query to the id field. For example, winget install 7zip --source winget will install 7zip.7zip because the moniker is an exact match. However, winget install --id 7zip --source winget will return no package found matching input criteria because there are multiple packages that have 7zip in their id.

So, by using the moniker field, it ensures that the exact match will be the latest version of python, and no fuzzy matching would be performed

Trenly avatar Feb 01 '23 17:02 Trenly

Makes sense, thanks.

MarcoPeraza avatar Feb 02 '23 05:02 MarcoPeraza

Close with reason: Moniker achieves desired behavior;

Trenly avatar Apr 30 '24 19:04 Trenly