skip to navigation
skip to content

jaraco.compat 1.4.1

Modules providing forward compatibility across some Python 2.x versions

Forward compatibility for Python packages, allowing future constructs to be borrowed before they’re available in the standard library.

This package is generally deprecated in favor of more surgical backports in separate packages.


License is indicated in the project metadata (typically one or more of the Trove classifiers). For more details, see this explanation.


Import functions from the appropriate pyXXcompat module in your python code. When you’re eventually ready to upgrade beyond pyXX, you can easily locate (with a grep) and replace those functions with the canonical implementations.


Say you want a namedtuple (introduced in Python 2.6) in a project which supports Python 2.5 and greater:

from py25compat import namedtuple
MyTuple = namedtuple('MyTuple', 'a b c')
mt = MyTuple(1,2,3)

With jaraco.compat installed, this code will run on Python 2.5 and greater. When the project is ready to move to Python 2.6, one can easily grep for py25compat and make the necessary replacements with minimal impact on the code. In this case:

from collections import namedtuple
MyTuple = namedtuple('MyTuple', 'a b c')
mt = MyTuple(1,2,3)
File Type Py Version Uploaded on Size
jaraco.compat-1.4.1-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2017-01-25 17KB
jaraco.compat-1.4.1.tar.gz (md5) Source 2017-01-25 15KB