zope.cachedescriptors
Method and property caching decorators
What it is and what it does
zope.cachedescriptors provides Python descriptors that cache computed values and automatically invalidate when their dependencies change. It includes CachedProperty (which recomputes when tracked attributes change), Lazy (which computes once and stays cached until manually deleted), and cached methods. Values are stored in _v_ volatile attributes, making them especially useful for persistent object frameworks where volatile storage is a standard pattern.
The package is a lightweight, dependency-minimal tool for avoiding redundant computation in classes where properties depend on instance state. It's designed for scenarios where you need fine-grained control over when a cached value is discarded—either automatically when dependencies shift, or manually when needed. It supports both decorator and functional syntax for backwards compatibility.
Use it for:
- Cache expensive computed properties in ORM models that invalidate when their source attributes are modified.
- Implement lazy-loaded attributes that compute once on first access and persist for the object's lifetime.
- Build idempotent methods whose results are cached based on arguments and instance state in persistent frameworks.
- Manage volatile attribute computation in Zope or other persistence layers where _v_ attributes have special semantics.
- Reduce redundant calculations in geometric or scientific classes where derived values depend on a few tracked inputs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides decorator-based caching for computed properties and methods that automatically invalidate when their dependencies change, storing cached values in volatile attributes suitable for persistent objects.
Yes, if you need dependency-aware property caching in a persistent object context or are already in the Zope ecosystem. The package is stable, has no known vulnerabilities, and installs with minimal friction. However, the aging maintenance status (no release in 336 days) and unclear license treatment warrant a review before adopting in new projects outside Zope—for simpler caching, functools.cached_property may suffice.
Install
zope-cachedescriptors on PyPI
pip
pip install zope-cachedescriptorsuv
uv add zope-cachedescriptorspoetry
poetry add zope-cachedescriptorsInstalling zope.cachedescriptors
Before you install
Low friction: pure Python wheel with only setuptools as a runtime dependency. Maintenance status is aging—last commit was 2025-09-12 and no release in 336 days—but the package is marked Production/Stable and has been in active use since 2007.
License in practice
Licensed under ZPL-2.1 (Zope Public License 2.1), which is OSI-approved but less common than MIT or Apache 2.0. License treatment is marked unclear, so review the full license text before adopting in proprietary or copyleft-sensitive projects.
Quickstart
from zope.cachedescriptors import property
import math
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
@property.CachedProperty('x', 'y')
def radius(self):
return math.sqrt(self.x**2 + self.y**2)
point = Point(1.0, 2.0)
print(point.radius) # Computed once, cached thereafter
point.x = 2.0
print(point.radius) # Recomputed because x changed
Verify before relying
- Whether ZPL-2.1 is compatible with your project's licensing requirements (treatment marked unclear in metadata).
- Performance characteristics and memory overhead of cached descriptors in high-throughput scenarios.
- Compatibility with modern ORMs or persistence frameworks beyond the Zope ecosystem.
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — setuptools |
| Maintenance | aging — 336 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 155,376/month — #10,817 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zope_cachedescriptors-6.0-py3-none-any.whl
Keywords: persistent, caching, decorator, method, property
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
backports.cached-propertyProvides the cached_property decorator for…
permissive · top 15,000 on PyPI
property-managerProvides custom Python property decorators for…
permissive · top 15,000 on PyPI
lazyProvides a @lazy decorator that defers…
permissive · top 15,000 on PyPI
async-propertyProvides Python decorators (@async_property and…
permissive · top 5,000 on PyPI
cachierCachier is a decorator that adds persistent,…
permissive · top 15,000 on PyPI
django-memoizeCaches function and method results in Django…
permissive · top 15,000 on PyPI
cacheyCachey provides intelligent caching for…
permissive · top 15,000 on PyPI
memoizationDecorator-based function result caching with…
permissive · top 5,000 on PyPI