Changes to How We Bundle Python in Visual Studio

Graham

With the release of Visual Studio 2022, we are making changes to how we support installing Python runtimes from Visual Studio Setup, to help reconcile the fact that the lifetime of Python versions available as binary installers from the Python Software Foundation is different to that of Visual Studio.

Each version of Visual Studio targets a specific Python version. For example, Visual Studio 2019 targeted Python 3.7, while Visual Studio 2022 targets Python 3.9 (Python 3.10 has just come out, but there are still many popular packages that are not fully supported, so Python 3.9 is a better choice). The life cycle of Python versions is very different to that of Visual Studio releases. New versions of Python are released annually, and binary installers are available for Windows for 1.5 years after release. That means that the last binary installer update for Python 3.9 will be made available by the Python Software Foundation (PSF) around March in 2022, and earlier versions are not getting installer updates at all.

Going forward, the most recent release of Visual Studio will support the most recent version of Python that has broad adoption. That means at some point in the future you can expect newer releases of Visual Studio 2022 to add support for Python 3.10, and then 3.11. However, older versions of the Python workload for Visual Studio will not be updated to support newer versions of Python.

This poses a problem if security issues are found in older versions of Python. In that case, our approach will be to mark versions of Python that are not getting updated installers built by PSF and that have known security issues being marked as “Out of Support” in Visual Studio setup. We will not be removing these versions, nor adding newer versions.

The reasons for doing this are:

  • We want to mark old versions as “out of support” and not select them by default to make it clear that these versions of Python are effectively past their end of life and may have security vulnerabilities;
  • At the same time, we don’t want to remove them, as customers may still need them; code is often updated to support new versions slowly if at all, and in many cases the security issues that may exist are edge cases that may not be relevant; customers should use their own judgement about the risks involved in continuing to use old versions of Python;
  • With the exception of adding Python 3.9 installer to Visual Studio 2019, we don’t want to add installers for new versions of Python that may not be fully supported by the Python workload; you can use newer versions of Python to run your older code in most cases with no issues, but we want to avoid giving the impression that changes to the Python language are fully supported by older versions of Visual Studio when they are not;
  • In most cases, you can simply install a newer version of Python from https://python.org or the Windows store and use your existing Python code unchanged; the number of breaking changes between Python versions is small and typically in edge cases;

To help aid this transition we made an exception in Visual Studio 2019 where we added an install option for Python 3.9 (which will in turn be marked as “out of support” sometime in 2022).

We’re making this change now as the language server in Visual Studio 2019 has been deprecated, while Visual Studio 2022 ships with Pylance, our modern and performant language server. The language server is the component most affected by changes in Python versions, so we will have more flexibility in the future as to how we reconcile the difference between the lifetime of Python versions and that of Visual Studio versions. We continue to evaluate how best to serve our users and may make further changes to our approach in the future.

0 comments

Leave a comment