Skip to main content

Modules providing forward compatibility across some Python 2.x versions

Project description

https://img.shields.io/pypi/v/jaraco.compat.svg https://img.shields.io/pypi/pyversions/jaraco.compat.svg https://img.shields.io/travis/jaraco/jaraco.compat/master.svg

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.

Usage

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.

Example

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)

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

jaraco.compat-2.2.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaraco.compat-2.2-py2.py3-none-any.whl (19.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file jaraco.compat-2.2.tar.gz.

File metadata

  • Download URL: jaraco.compat-2.2.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for jaraco.compat-2.2.tar.gz
Algorithm Hash digest
SHA256 502c30eb4790f575b60ba0e1626f9e0136bede24ae01af71c35e5b9fe907e74a
MD5 e2893cdd565a7e0a2bdd4f8d6adccccf
BLAKE2b-256 6054d2723a8fe68039e8724fc0f095837c90be6893051aedd135888d382c9bbe

See more details on using hashes here.

File details

Details for the file jaraco.compat-2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: jaraco.compat-2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for jaraco.compat-2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a7e93c2bd6c156d7eacec09d73de2f3e73de2302e9486262d7a6f867d99eb11c
MD5 23edfdfa7ce2e60648ecb629ae7f9512
BLAKE2b-256 f0310d468d0a11e6bde941a79d50d164ee0624333d7f425eeae31f26cfc93f51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page