$npx skillfedfor your agent

pyrsistent

Persistent/Functional/Immutable data structures

With conditionsPyPI Released Oct 202341.8M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pyrsistent-0.20.0-py3-none-any.whl
v0.20.0 · released 2023-10-25 · Python >=3.8

Yes, if you need immutable collections and can tolerate aging maintenance. The library is stable, has no known vulnerabilities, installs with zero friction, and is widely used (top 1000 on PyPI). However, the last release was over 1000 days ago; verify that the package still meets your Python version and feature needs before committing to it for new projects.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction; pure Python wheel with no runtime dependencies.
  • Maintenance is aging—last release was 1024 days ago—but the repository remains active and unarchived with solid community adoption (2196 stars).

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use, modify, and distribute pyrsistent freely in commercial and open-source projects with minimal restrictions.

last release 2023-10-25 (1024 days) · last repo commit 2026-01-31 · 2,196 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 41,840,134 downloads/mo, #666 on PyPI

Verify before relying

pip install pyrsistent

from pyrsistent import v, m, s

# Immutable vector (like list)
v1 = v(1, 2, 3)
v2 = v1.append(4)  # returns new vector, v1 unchanged

# Immutable map (like dict)
m1 = m(a=1, b=2)
m2 = m1.set('c', 3)  # returns new map, m1 unchanged

# Immutable set
s1 = s(1, 2, 3)
s2 = s1.add(4)  # returns new set, s1 unchanged
  • Performance characteristics (e.g., actual overhead vs. standard collections) under realistic workloads
  • Compatibility with type checkers like mypy for persistent collection types
  • Whether the aging maintenance status affects bug fixes or Python version support going forward
Same gist for agents: .md · .json

What it is and what it does

Pyrsistent is a library of immutable data structures designed to prevent hidden side effects in Python code. Instead of mutating collections in place, all write operations return a new copy with the requested changes, leaving the original untouched. This makes reasoning about program behavior simpler—you can trust that an object you hold a reference to will never be modified by code elsewhere in your application.

The library includes persistent versions of common Python collections: PVector (like list), PMap (like dict), PSet (like set), PRecord (a typed, fixed-field map), PClass (a typed Python class), PBag, PList, and PDeque. All are designed to share common elements through path copying for efficiency. The structures support standard Python protocols (Sequence, Mapping, Set, Hashable), making them drop-in replacements in many contexts, and can be converted to and from standard Python collections via freeze and thaw functions.

Use it for

  • Building applications where immutability prevents accidental state mutations and simplifies debugging
  • Using persistent collections as dictionary keys or set members (they are hashable)
  • Implementing undo/redo systems by keeping historical versions of data structures
  • Writing concurrent code where shared immutable data eliminates race conditions
  • Defining data records with optional type checking and fixed fields (PRecord, PClass)
  • Transforming nested persistent structures (maps and vectors) with the transform API

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need immutable collections and can tolerate aging maintenance.

The library is stable, has no known vulnerabilities, installs with zero friction, and is widely used (top 1000 on PyPI). However, the last release was over 1000 days ago; verify that the package still meets your Python version and feature needs before committing to it for new projects.

Install

pyrsistent on PyPI

Before you install

Low install friction; pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 1024 days ago—but the repository remains active and unarchived with solid community adoption (2196 stars).

License in practice

MIT license is permissive; you can use, modify, and distribute pyrsistent freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install pyrsistent

from pyrsistent import v, m, s

# Immutable vector (like list)
v1 = v(1, 2, 3)
v2 = v1.append(4)  # returns new vector, v1 unchanged

# Immutable map (like dict)
m1 = m(a=1, b=2)
m2 = m1.set('c', 3)  # returns new map, m1 unchanged

# Immutable set
s1 = s(1, 2, 3)
s2 = s1.add(4)  # returns new set, s1 unchanged

Verify before relying

  • Performance characteristics (e.g., actual overhead vs. standard collections) under realistic workloads
  • Compatibility with type checkers like mypy for persistent collection types
  • Whether the aging maintenance status affects bug fixes or Python version support going forward

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceAging 1,024 days since the last release
Last repo commit
First released
Downloads41,840,134 / month, #666 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPy

Evidence: pyrsistent-0.20.0-py3-none-any.whl

Tags

Capabilities
immutable data structures pythonpersistent collections functionalimmutable list dict setfunctional data structures clojure-likeno mutation copy-on-writeimmutable records with type checkinghashable collections as dict keys
Topics
immutable-data-structuresfunctional-programmingpersistent-collections

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “persistent collections functional”

  • pyrsistentPyrsistent provides immutable, persistent data structures (vectors,…
  • immutablesProvides an immutable mapping type backed by a Hash Array Mapped Trie…
  • rpds-pyProvides Python bindings to Rust's persistent data structures (rpds…

Give your agent the search over MCP, or paste the wish link into any chat.

Similar packages

rpds-py With conditions
PyPI · released Jun 2026

Provides Python bindings to Rust's persistent data structures (rpds crate), offering immutable hash maps, sets, and lists with structural sharing for efficient memory use.

MITcompiled wheel · 3.11+
613.6Mdownloads / mo
immutables With conditions
PyPI · Libraries · released Oct 2024

Provides an immutable mapping type backed by a Hash Array Mapped Trie (HAMT) data structure, offering O(log N) performance for get and set operations with hashable, comparable, and pickleable Map objects.

Apache-2.0compiled wheel · 3.8.0+aging
2.9Mdownloads / mo
itypes Skip
PyPI · WWW/HTTP · released Apr 2020

Provides immutable container types (Dict and List) for Python that prevent modification after creation and automatically coerce nested structures to immutable equivalents.

BSD-3-Clausepure Pythonabandoned
1.7Mdownloads / mo
constantdict With conditions
PyPI · Libraries · released Jul 2025

Provides an immutable dictionary class that wraps Python's built-in dict, preventing in-place modifications while remaining hashable and comparable to regular dicts.

MITpure Python · 3.7+aging
74.1Kdownloads / mo
frozendict Worth it
PyPI · Libraries · released Nov 2025

Provides an immutable, hashable dictionary implementation with a dict-like API, supporting operations like set(), delete(), and merge via the | operator while guaranteeing immutability.

Install it if you need immutable mappings for hashing, thread safety, or functional programming patterns.

LGPL-3.0-onlypure Python · 3.6+
17.6Mdownloads / mo
multiset With conditions
PyPI · Software Development · released Aug 2024

Provides a mutable and immutable multiset data structure that extends Python's set semantics to allow duplicate elements, supporting set operations like union, intersection, and difference.

However, maintenance is dormant (last release 717 days ago), so consider whether you need active support or can rely on a mature, unchanging implementation.

MITpure Python · 3.8+dormant
453.1Kdownloads / mo

See also immutabledict · lenses · zict · jaraco.collections