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 Code style: Black https://readthedocs.org/projects/jaracocompat/badge/?version=latest

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-3.1.tar.gz (12.4 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-3.1-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: jaraco.compat-3.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for jaraco.compat-3.1.tar.gz
Algorithm Hash digest
SHA256 5a8368924b6bdce5fc6dfee922eea8db18ccb0127a30d4672580b7d0d100c005
MD5 a6a81e9d61f417cb6f78a8c498411da5
BLAKE2b-256 8e72ef7d54585ded429c55892de1fe0d40288a2723faf60864272928840756f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jaraco.compat-3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for jaraco.compat-3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bf3e76713f3ab5d6dc676e585369d233a888144465112b268ad3012331a91598
MD5 fb913ad5a34fb01673a09fa53b6c19eb
BLAKE2b-256 88eedfb516a3537a0ee887d166fbe29c41c80f553210798203bb00e74810f2c8

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