Skip to main content

Immutable wrapper around dictionaries (a fork of frozendict)

Project description

immutabledict

PyPI Conda PyPI - Python Version

License Build Codecov PyPI - Downloads

A fork of the original frozendict, an immutable wrapper around dictionaries. This library is a pure Python, MIT-licensed alternative to the new LGPL-3.0 licensed frozendict.

It implements the complete mapping interface and can be used as a drop-in replacement for dictionaries where immutability is desired. The immutabledict constructor mimics dict, and all of the expected interfaces (iter, len, repr, hash, getitem) are provided. Note that an immutabledict does not guarantee the immutability of its values, so the utility of hash method is restricted by usage.

The only difference is that the copy() method of immutable takes variable keyword arguments, which will be present as key/value pairs in the new, immutable copy.

Installation

Available as immutabledict on :

Example

from immutabledict import immutabledict

my_item = immutabledict({"a": "value", "b": "other_value"})
print(my_item["a"]) # Print "value"

Differences with the old original frozendict package

  • Dropped support of EOL Python versions (version 1.0.0 supports Python 3.5, versions <= 2.2.1 supports Python 3.6)
  • Fixed collections.Mapping deprecation warning
  • Typing
  • PEP 584 union operators

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

immutabledict-2.2.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

immutabledict-2.2.4-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file immutabledict-2.2.4.tar.gz.

File metadata

  • Download URL: immutabledict-2.2.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure

File hashes

Hashes for immutabledict-2.2.4.tar.gz
Algorithm Hash digest
SHA256 3bedc0741faaa2846f6edf5c29183f993da3abaff6a5961bb70a5659bb9e68ab
MD5 f571ad2050279f2762ec11e9586e1358
BLAKE2b-256 ab96548ee1a774062b2bec740ef03ab427f20e802d66b1db23a42ba20cb88121

See more details on using hashes here.

File details

Details for the file immutabledict-2.2.4-py3-none-any.whl.

File metadata

  • Download URL: immutabledict-2.2.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure

File hashes

Hashes for immutabledict-2.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c827715c147d2364522f9a7709cc424c7001015274a3c705250e673605bde64b
MD5 1674f801c2da1293949e5f2304a36ecf
BLAKE2b-256 04087c5af841703fe40ff68cd6a5d1746ecb8037b495e8685d8b74565cb7d3c7

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