skillfed

cached-property

A decorator for caching properties in classes.

cached-property Permissive license BSD DORMANT 704 v2.0.1 released

Install

cached-property on PyPI

pip

pip install cached-property

uv

uv add cached-property

poetry

poetry add cached-property

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 657 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: cached_property-2.0.1-py3-none-any.whl

Keywords: cached-property

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

About cached-property

from the package's own PyPI description — quoted content, verbatim

cached-property

Github Actions status (image) PyPI (image) Code style: ruff (image)

A decorator for caching properties in classes.

Why?

  • Makes caching of time or computational expensive properties quick and easy.
  • Because I got tired of copy/pasting this code from non-web project to non-web project.
  • I needed something really simple that worked in Python 2 and 3. (Python 3.8 added a version of this decorator as @functools.cached_property.)

How to use it

Let's define a class with an expensive property. Every time you stay there the price goes up by $50!

```python class Monopoly:

def __init__(self):
    self.boardwalk_price = 500

@property
def boardwalk(self):
    # In reality, this might represent a database call or time
    # intensive task...

Read as markdown · JSON record · Source repository · Homepage

Similar packages