Skip to main content

Frozen Cub

pypi version

A high-performance library for immutable, hashable data structures in Python. Built with Cython for speed.

Supports Python 3.12, 3.13, and 3.14

Features

  • FrozenDict: An immutable dictionary that can be used as a dict key or in sets
  • freeze(): Recursively freeze nested data structures (dicts, lists, tuples, sets)
  • LRUCache: A fast LRU cache with O(1) operations
  • CacheKey: A lightweight hashable key for caching based on two values

Installation

pip install frozen-cub

With uv:

uv add frozen-cub

Quick Start

Freezing Data Structures

from frozen_cub.frozen import freeze, FrozenDict

# Freeze a nested dictionary
data = {
    "user": "bear",
    "settings": {"theme": "dark", "notifications": True},
    "tags": ["python", "cython"],
}
frozen = freeze(data)

# Now it's hashable - use as dict key or in sets
cache = {frozen: "some_result"}
unique_configs = {frozen}

FrozenDict

from frozen_cub.frozen import FrozenDict

# Create directly from items
fd = FrozenDict([("a", 1), ("b", 2)])

# Or from a dict
fd = FrozenDict({"a": 1, "b": 2})

# Access like a regular dict
print(fd["a"])  # 1
print(fd.get("c", "default"))  # "default"
print(list(fd.keys()))  # ["a", "b"]

# Use as a dict key (it's hashable!)
lookup = {fd: "found it"}

LRU Cache

from frozen_cub.lru_cache import LRUCache

# Create a cache with max 100 items
cache: LRUCache[str, dict] = LRUCache(capacity=100)

# Basic operations
cache["key"] = {"data": "value"}
result = cache.get("key")  # Returns {"data": "value"}
result = cache.get("missing", "default")  # Returns "default"

# Dict-like interface
"key" in cache  # True
del cache["key"]
len(cache)  # 0

CacheKey

from frozen_cub.utils import CacheKey

# Create a hashable key from two values
key = CacheKey(int, 42)

# Use as dict key or in sets
cache = {key: "cached_value"}

# For more than two values, use tuples
key = CacheKey("my_cache", (arg1, arg2, arg3))

Cython API

For maximum performance in other Cython code, you can use the inlined C functions directly:

from frozen_cub.frozen cimport inline_freeze, FrozenDict

# inline_freeze is inlined at compile time - zero function call overhead
cdef object frozen = inline_freeze(my_dict)

API Reference

freeze(obj)

Recursively converts mutable objects to immutable equivalents:

Input Type Output Type
dict FrozenDict
list tuple
set frozenset

FrozenDict

An immutable, hashable dictionary.

Methods:

  • get(key, default=None) - Get value with optional default
  • keys() - Return list of keys
  • values() - Return list of values
  • items() - Return list of (key, value) tuples
  • __getitem__(key) - Get value, raises KeyError if missing
  • __contains__(key) - Check if key exists
  • __hash__() - Returns cached hash value
  • __len__() - Return number of items

LRUCache[K, V]

A generic LRU cache with configurable capacity.

Constructor:

  • LRUCache(capacity=512) - Create cache with max capacity

Methods:

  • get(key, default=None) - Get value with optional default
  • set(key, value) - Set value (alias for __setitem__)
  • pop(key, default=None) - Remove and return value
  • clear() - Remove all items
  • __getitem__(key) - Get value, raises KeyError if missing
  • __setitem__(key, value) - Set value
  • __delitem__(key) - Delete key, raises KeyError if missing
  • __contains__(key) - Check if key exists
  • __len__() - Return number of items

CacheKey

A lightweight, hashable key for caching based on two values.

Constructor:

  • CacheKey(value1, value2) - Create a cache key from two hashable values

Methods:

  • __hash__() - Returns cached hash value
  • __eq__(other) - Compare equality with another CacheKey

Metadata

Release files for frozen-cub 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for frozen-cub 0.3.4
File Actions
frozen_cub-0.3.4-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for frozen_cub-0.3.4-cp315-cp315-win_amd64.whl
frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ ARM64, Linux glibc 2.24+ ARM64 Details for frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
frozen_cub-0.3.4-cp315-cp315-macosx_15_0_arm64.whl CPython 3.15 CPython 3.15 macOS 15.0+ ARM64 Details for frozen_cub-0.3.4-cp315-cp315-macosx_15_0_arm64.whl
frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
frozen_cub-0.3.4-cp314-cp314-macosx_15_0_arm64.whl CPython 3.14 CPython 3.14 macOS 15.0+ ARM64 Details for frozen_cub-0.3.4-cp314-cp314-macosx_15_0_arm64.whl
frozen_cub-0.3.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for frozen_cub-0.3.4-cp313-cp313-win_amd64.whl
frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.24+ ARM64, Linux glibc 2.28+ ARM64 Details for frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
frozen_cub-0.3.4-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for frozen_cub-0.3.4-cp313-cp313-macosx_15_0_arm64.whl

Total release size: 1.8 MB

Release files / frozen_cub-0.3.4-cp315-cp315-win_amd64.whl

Download URL frozen_cub-0.3.4-cp315-cp315-win_amd64.whl
Size 16.0 kB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
1ea8924eee102a05b5a50d724319b3333248e838b784a36ebb530d88364ab839
BLAKE2b-256 checksum
How to use checksums
9cab1e0d533b55a8ea704d2c73f768fb6f5f1c4c676c87040cc1748154548595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 262.4 kB
Tags CPython 3.15 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
26f9c5f72d20b9a0dc1ee40dd01f2c2989850726be774bdce98fa7b016191d57
BLAKE2b-256 checksum
How to use checksums
047cb2f63403cf53fce098e479107af19a9f3d1b1892580901222b6dff498477
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL frozen_cub-0.3.4-cp315-cp315-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 271.9 kB
Tags CPython 3.15 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
8ee755b0ece248d37214b835cfa82a2bdda75af2448c79af6a9afbc4321595b8
BLAKE2b-256 checksum
How to use checksums
e7c8da19555fc3bcb724e36df3634360d27d27e2057dc57519b2061ccdf4ecd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp315-cp315-macosx_15_0_arm64.whl

Download URL frozen_cub-0.3.4-cp315-cp315-macosx_15_0_arm64.whl
Size 60.0 kB
Tags CPython 3.15 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
ef7ee649a520b3ef76aea1f75648b423a4413f2f7fca5feed5721e99ed2546aa
BLAKE2b-256 checksum
How to use checksums
7b43bffe33c7c89bb4e68fc1830674bf08893f087616e8b4c377f320c5e0684e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 261.1 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9c6969603b9e3c2388bfca486deca9b7d95527358229f7cde3893214b9165e74
BLAKE2b-256 checksum
How to use checksums
65bb8455b819ce7708e678b261fe0b8cbddea1a19d8722e94a2f38317b573d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL frozen_cub-0.3.4-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 269.7 kB
Tags CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
fedede20c8ed864762eebb1440df678dfa9a7d20413d44d75f734a988af21722
BLAKE2b-256 checksum
How to use checksums
c1ab7c5d2388cf6fdc6079f24680a07fb106fef7c2982cc99c88933e8e0fb785
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp314-cp314-macosx_15_0_arm64.whl

Download URL frozen_cub-0.3.4-cp314-cp314-macosx_15_0_arm64.whl
Size 60.0 kB
Tags CPython 3.14 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7417bf20d597513f034d10f97bb3cbfccf74a73626ce0df9ba5bdf48a921e399
BLAKE2b-256 checksum
How to use checksums
1dcd325bff6d9b72acf3786cf5a9b845e1fbab1fbbee7a54f8556e7a944b0729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp313-cp313-win_amd64.whl

Download URL frozen_cub-0.3.4-cp313-cp313-win_amd64.whl
Size 16.0 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
6e2184e6f7017c348c48f3db01953cb0694329df96118a24b064c5a4f073da09
BLAKE2b-256 checksum
How to use checksums
1ef46b9bbb8a28a7591b45e4c58b5a535ee52e772e3d687d8dd336cc1db470a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 261.9 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
81e83c79a4acfc6e3534153e47651cacc7f1c851e0688311184f293d4ffc965a
BLAKE2b-256 checksum
How to use checksums
2ed613ac6d990b2cdb50663873409aa0e638c7db95bacbdea2221cea52def9be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl

Download URL frozen_cub-0.3.4-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Size 269.5 kB
Tags CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
29e19e4345dfa2988c6bebea1a2c789fc1f20697ac6d8131d711daec416af9b7
BLAKE2b-256 checksum
How to use checksums
5e564165a7e94466c42171ce13c1969ec985f7103c8aedbe48e2044ea8dd2b94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / frozen_cub-0.3.4-cp313-cp313-macosx_15_0_arm64.whl

Download URL frozen_cub-0.3.4-cp313-cp313-macosx_15_0_arm64.whl
Size 59.8 kB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
4ac98c07cde93c12e5a59303b11e71c8b858c59980884fdb535a50e420195f00
BLAKE2b-256 checksum
How to use checksums
505c5491b68f2bf8fa5beb00a61fd23aa1717b4b93f1cd2b0e503cd11c1d2314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Security for frozen-cub 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 11 files in this release have been uploaded with provenance metadata.

Select from 11 files

Attestation for frozen_cub-0.3.4-cp315-cp315-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page