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 is closely derived from 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:

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

This preferentially imports from the Python standard library if available, using the chainmap only when it isn’t otherwise available.

Optionally, you may import it all of the time:

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 and say, 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.0

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.0
File Size Uploaded
chainmap-1.0.0.zip 11.3 kB Details
chainmap-1.0.0.tar.gz 5.9 kB Details

Built distribution (wheel)

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

Total release size: 23.9 kB

Release files / chainmap-1.0.0.zip

Download URL chainmap-1.0.0.zip
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bd5ab11cef3a266d5a0d4a2a1093921520df52c61f53a4b48033144acb617468
BLAKE2b-256 checksum
How to use checksums
b1d5ffd2d90766f1918eb74d21c759bbc48cead22ee816af62fca9307bae9400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / chainmap-1.0.0.tar.gz

Download URL chainmap-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2e24b2efa3494b16772282812efcd712b1d6b80e1b761a56b1b7cbc8fe0313c4
BLAKE2b-256 checksum
How to use checksums
baa17aff9c7747966f30e6a8cace9bf542edc5e0fe9e18d60c06ec409fcc0ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL chainmap-1.0.0-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
be7e2b8eefeed54dfad7fd33b0b13f6d6408303c08dd677a73232aefeabde89c
BLAKE2b-256 checksum
How to use checksums
997c17181804025a457477bf361b4fcecbefdfd564326c1f1dccc5e30ef2bc57
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

1.0.1

3 release files

This release

1.0.0 This release

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