skillfed

zope.cachedescriptors

Method and property caching decorators

zope-cachedescriptors v6.0 155.4K downloads/30d#10,817 on PyPI6
License unclear ZPL-2.1 AGING released

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-cachedescriptors

uv

uv add zope-cachedescriptors

poetry

poetry add zope-cachedescriptors

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Zope Public LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development

Tags

cached property decoratormethod caching with dependenciescomputed property invalidationvolatile attribute cachingpersistent object descriptorslazy attribute computationdependency-aware caching
cachingdescriptorspersistent-objects

More Software Development packages