Skip to main content

A backport of recent additions to the '' module.

Project description


    # ABCs live in "" in Python >= 3.3
    from import Coroutine, Generator
except ImportError:
    # fall back to import from "backports_abc"
    from backports_abc import Coroutine, Generator

You can also install the ABCs into the stdlib by calling the patch() function:

import backports_abc

    # ABCs live in "" in Python >= 3.3
    from import Coroutine, Generator
except ImportError:
    # fall back to import from "collections" in Python <= 3.2
    from backports_abc import Coroutine, Generator

Currently, patch() provides the following names if missing:




  • inspect.isawaitable(obj)

All of them are also available directly from the backports_abc module namespace.

In Python 2.x and Python 3.2, it patches the collections module instead of the module. Any names that are already available when importing this module will not be overwritten.

The names that were previously patched by patch() can be queried through the mapping in backports_abc.PATCHED.


0.5 (2016-11-12)

  • support old-style (mro-missing) classes

0.4 (2015-09-14)

  • direct wheel building support

  • make all names available at the module level instead of requiring patching

0.3 (2015-07-03)

  • removed patching of inspect.iscoroutine() as it is not ABC based

0.2 (2015-07-03)

  • require explicit backports_abc.patch() call to do the patching (avoids side-effects on import and allows future configuration)

  • provide access to patched names through global PATCHED dict

  • add ABC based implementations of inspect.iscoroutine() and inspect.isawaitable()

0.1 (2015-06-24)

  • initial public release

  • provided ABCs: Generator, Coroutine, Awaitable

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backports_abc-0.5.tar.gz (9.8 kB view hashes)

Uploaded source

Built Distribution

backports_abc-0.5-py2.py3-none-any.whl (5.2 kB view hashes)

Uploaded 3 5

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page