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.

Transparent vs. non-transparent
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.

How to use the table?

 * 1) If transparent? is not yes, and your package always imports the module listed there, explicitly depend on the package providing that module.
 * 2) If transparent? is yes or your package has fallback from package to module listed in transparent?:
 * 3) If all Python implementations supported by your package are marked as no in relevant implementations, do not add any dependency at all (built-in module will always be used).
 * 4) Otherwise, depend on the virtual.