FrozenList

raw JSON →
1.8.0 verified Tue May 12 auth: no python install: verified quickstart: verified

FrozenList is a Python library providing a list-like structure that implements collections.abc.MutableSequence. The list remains mutable until the freeze() method is called, after which any modifications raise a RuntimeError. The current version is 1.8.0, released in October 2025, with a release cadence of approximately one to two updates per year.

pip install frozenlist
error ModuleNotFoundError: No module named 'frozenlist'
cause The 'frozenlist' package has not been installed in the Python environment you are using.
fix
Install the package using pip: pip install frozenlist
error RuntimeError: Cannot modify frozen list.
cause You attempted to modify a FrozenList instance after its `freeze()` method has been called, rendering it immutable.
fix
Ensure modifications are made before calling freeze(), or create a new FrozenList instance if further modifications are required.
error ERROR: Could not build wheels for frozenlist, which is required to install pyproject.toml-based projects.
cause This error typically occurs during installation, often when Python cannot compile the underlying C extensions of 'frozenlist', sometimes due to missing build tools (like `gcc`) or compatibility issues with newer Python versions (e.g., Python 3.11, 3.12) that might require a more recent 'frozenlist' version or specific compiler flags.
fix
Ensure your build tools (like gcc) are installed and up-to-date. If using a newer Python version, try upgrading pip and setuptools (pip install --upgrade pip setuptools) or check if a newer 'frozenlist' version with pre-built wheels for your Python version is available.
breaking Dropped support for Python 3.7 in version 1.4.0.
fix Upgrade your Python environment to version 3.8 or newer.
breaking Dropped support for Python 3.6 in version 1.3.0.
fix Upgrade your Python environment to version 3.7 or newer.
gotcha Attempting to modify a FrozenList after calling freeze() raises a RuntimeError.
fix Ensure that all necessary modifications are made before freezing the list.
gotcha A FrozenList instance is hashable only when frozen; attempting to hash a non-frozen instance raises a RuntimeError.
fix Call freeze() before attempting to hash a FrozenList instance.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.00s 18.3M
3.10 slim (glibc) - - 0.00s 19M
3.11 alpine (musl) - - 0.00s 20.2M
3.11 slim (glibc) - - 0.00s 21M
3.12 alpine (musl) - - 0.00s 12.1M
3.12 slim (glibc) - - 0.00s 13M
3.13 alpine (musl) - - 0.00s 11.7M
3.13 slim (glibc) - - 0.01s 12M
3.9 alpine (musl) - - 0.00s 17.8M
3.9 slim (glibc) - - 0.01s 18M

Demonstrates creating a FrozenList, modifying it, freezing it, and handling attempts to modify it after freezing.

from frozenlist import FrozenList

# Create a mutable FrozenList
fl = FrozenList([1, 2, 3])
fl.append(4)
print(fl)  # Output: [1, 2, 3, 4]

# Freeze the list
fl.freeze()

# Attempting to modify the frozen list raises RuntimeError
try:
    fl.append(5)
except RuntimeError as e:
    print(e)  # Output: Cannot modify frozen list.