Skip to main content
PyPI Package latest release PyPI Package monthly downloads Supported versions Supported implementations Wheel packaging support Test line coverage

This module is a polyfill, implementing ChainMap for reasonably-recent versions of Python that do not have collections.ChainMap–namely, Python 2.6, Python 3.2, and PyPy3 releases based on Python 3.2. (It will also work as expected on Python 2.7, PyPy, and Python 3.3 and higher, but it is not needed there since those verions’ collections modules contains a ChainMap implementation.)

The code for this package is closely derived from the Python 3.5 source code at hg.python.org, (especially the collections and reprlib modules). Several changes have been made to ensure Python 2.6 compatibility, and tests and packaging have been added.

Typical usage:

from chainmap import ChainMap

If you prefer to preferentially import from the Python standard library when ChainMap is available there, this will do the trick:

try:
    from collections import ChainMap
except ImportError:
    from chainmap import ChainMap

Please see the standard documentation for details on how to use ChainMap.

If you’re not sure why someone would use a ChainMap, they are useful for managing “nested” contexts and “overlays.” See e.g. my options, quoter, and say packages, which use them quite extensively for flexible option handling. You can find similar uses in the Context class of Django’s template engine.

Installation

To install or upgrade to the latest version:

pip install -U chainmap

To easy_install under a specific Python version (3.3 in this example):

python3.3 -m easy_install --upgrade chainmap

(You may need to prefix these with sudo to authorize installation. In environments without super-user privileges, you may want to use pip’s --user option, to install only for a single user, rather than system-wide.)

Metadata

Release files for chainmap 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for chainmap 1.0.1
File Size Uploaded
chainmap-1.0.1.zip 11.5 kB Details
chainmap-1.0.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chainmap 1.0.1
File Interpreter ABI Platform
chainmap-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 24.5 kB

Release files / chainmap-1.0.1.zip

Download URL chainmap-1.0.1.zip
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ad8e5a6c3a6af30e9cfa4bdc1918d819677de8428b7428c9fb8a13a18216ce41
BLAKE2b-256 checksum
How to use checksums
63ff3ac9cc6fa37624d2f3afc1c1465c4a19f1dbc46d342e578dee2d630b4bc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / chainmap-1.0.1.tar.gz

Download URL chainmap-1.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c1cd76c679dd7af982ec5a45788ef4a0dfc20e77f27ccdeca289a5141862ff64
BLAKE2b-256 checksum
How to use checksums
dc7915bb7dcc1e8a614dadc4c2bf2d79497418fb22859e30fd16fdf1ac037174
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / chainmap-1.0.1-py2.py3-none-any.whl

Download URL chainmap-1.0.1-py2.py3-none-any.whl
Size 6.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d14574cf97732161d25d07ccb06c83b95ce79b9c9da1cc4f958b43c5ed72efc6
BLAKE2b-256 checksum
How to use checksums
27bd3599f48eaf21e760230e55b48e0e319c5753c010c5a4905b899f7dd118f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.3

2 release files

1.0.2

3 release files

This release

1.0.1 This release

3 release files

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page