Currently, UsePython task just switches versions that are pre-cached on image (example).
It works for the most of the use-cases, because image always contains latest patch version for every major.minor pair.
However, some customers prefer to specify exact version of Python and would like to control it by themselves / freeze specific version. Current implementation of UsePython doesn't allow it.
Versions of Python can be installed on-flight from https://github.com/actions/python-versions. This repo distributes versions of Python via GH releases. Also it contains versions-manifest.json as an index of versions.
Installation on-flight is pretty quick and should cover those use-cases. Also it is not a breaking change because task will try to download version only in case if it is not found locally.
The same changes were already done for GitHub Actions task setup-python.
Related PRs:
1) https://github.com/actions/setup-python/pull/85
2) https://github.com/actions/toolkit/pull/382
This would be very useful for trying out versions of python without waiting for deployment of a new image.
This would also be really nice for self-hosted agents
For example NuGetToolInstaller@1 will "find, download, and cache a specified version of NuGet." Very easy to use. But UsePythonVersion@0 instead has a whole section in the documentation "How can I configure a self-hosted agent to use this task?" which describes a manual process for setting up a very specific folder structure inside _work/_tool, which then needs to be performed again for each new version.
Most helpful comment
This would be very useful for trying out versions of python without waiting for deployment of a new image.