# MagicStack/immutables

A high-performance immutable mapping type for Python.

Repository: https://github.com/MagicStack/immutables
Canonical: https://ross.abutalabs.com/products/magicstack-immutables
Language: C
License: NOASSERTION
License Family: other
Topics: python, immutable-collections, hamt, immutable-datastructures, python3, immutable, frozen
Last push: 2025-05-20T02:55:20+00:00

## Health v2 (maintenance only)
Score: 33/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 22, release rhythm 8, longevity 100
- inputs: {"age_days": 3078, "days_push": 470, "days_rel": 693, "gap_med": null, "n_releases_24m": 1}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1204, forks 59 (observed 2026-08-28T04:03:59.005734+00:00)

## What it is
A high-performance immutable mapping type for Python based on a Hash Array Mapped Trie (HAMT). It is the implementation used in CPython's contextvars module and offers O(log N) set/get operations with hashable, pickleable Map objects.

## Use cases
- immutable dictionary for python
- hamt mapping implementation
- hashable frozen mapping type
- efficient copy-on-write dict alternative
- immutable data structures for functional python
- thread-safe immutable map

## When to choose
- you need immutable, hashable mappings with fast O(log N) updates
- you want efficient structural sharing instead of dict copy-on-write
- you need bulk mutation APIs that produce new derived maps

## When to avoid
- you only need plain mutable dicts
- you need immutable lists or sets rather than mappings
- you require strict O(1) updates for very large mappings

## Facets
- artifact type: library
- maturity: stable
- function: serialization, concurrency
- domain: programming-languages, developer-tools
- platform: python, cross-platform
- tags: immutable-collections, hamt, functional-datastructures, persistent-data-structures, cpython, algorithms

## Member repositories
- MagicStack/immutables (main) score 33

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:59.005734+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:19:38.078497+00:00, confidence not recorded.
  - readme: https://github.com/MagicStack/immutables (fetched 2026-08-28T04:03:59.005734+00:00, sha e5decdfa08c3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
