Project:Python/Virtuals

This page describes the virtual packages introduced by the Python team.

Virtual packages for backports
Those virtual packages are used to reference the Python modules which are available in newer versions of Python and that were backported to older versions of Python using external packages.

There are two classes of backport packages: transparent and non-transparent. Transparent backports install missing modules using the same names, therefore making code written for newer versions of Python work without modification. Non-transparent backports use different module names, therefore the code using them has to explicitly support them.

For transparent backports, the packages can safely depend on the virtuals to support old Python implementations. However, if they no longer support an old implementation (even with the backports installed), the dependency should be removed altogether.

For non-transparent backports, the support for backport in the package has to be evaluated. If a package depends on a backport module unconditionally (i.e. can't work without it even on newer Python versions), it needs to depend on the backport directly. The virtual is a suitable dependency only if the backport (or the original package) is used as a fallback, and therefore the package can work without the backport on newer Python versions.