# tobgu/pyrsistent

Persistent/Immutable/Functional data structures for Python

Repository: https://github.com/tobgu/pyrsistent
Canonical: https://ross.abutalabs.com/products/pyrsistent
Language: Python
License: MIT
License Family: permissive
Topics: immutable, datastructures, python, functional
Last push: 2026-01-31T05:46:07+00:00

## Health v2 (maintenance only)
Score: 62/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 65, release rhythm 35, longevity 100
- inputs: {"age_days": 4822, "days_push": 214, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2199, forks 168 (observed 2026-08-28T04:06:25.509209+00:00)

## What it is
Pyrsistent is a Python library providing persistent (immutable) data structures such as PVector, PMap, PSet, PRecord, and PClass, inspired by Clojure's functional collections. Mutating operations return new copies with structural path-sharing, leaving originals untouched.

## Use cases
- use immutable lists and dicts in python to avoid side effects
- share state safely across threads without locks
- model records with type and invariant checking
- implement undo/history by keeping old versions of data structures
- write functional-style python code with persistent collections

## When to choose
- you need immutable data structures with efficient structural sharing in Python
- you want Clojure-like persistent vectors, maps, and sets with a pythonic API
- you need checked records/classes with field types and invariants

## When to avoid
- you need maximum raw performance for mutable-heavy workloads
- you only need simple frozen dataclasses or namedtuples
- you need data structures beyond those provided (check pyrsistent-extras instead)

## Facets
- artifact type: library
- maturity: stable
- function: serialization
- domain: developer-tools, programming-languages
- platform: python, cross-platform
- tags: immutable-data-structures, persistent-collections, functional-programming, pvector, pmap

## Member repositories
- tobgu/pyrsistent (main) score 62

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:25.509209+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-30T02:47:07.977198+00:00, confidence not recorded.
  - readme: https://github.com/tobgu/pyrsistent (fetched 2026-08-28T04:06:25.509209+00:00, sha 7aea8bedef8d)
  - registry_pypi: https://pypi.org/pypi/pyrsistent/json (fetched 2026-08-29T10:27:17.780185+00:00, sha c70e132c9b6c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
