cached-property
A decorator for caching properties in classes.
Install
cached-property on PyPI
pip
pip install cached-propertyuv
uv add cached-propertypoetry
poetry add cached-propertyPackage 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
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
permissive · top 1,000 on PyPI
cachetoolspermissive · top 1,000 on PyPI
async-lrupermissive · top 1,000 on PyPI
multitaskingpermissive · top 1,000 on PyPI
py-key-value-aiopermissive · top 1,000 on PyPI
asgirefpermissive · top 1,000 on PyPI
snowflake-connector-pythonpermissive · top 1,000 on PyPI
fastmcp-slimpermissive · top 1,000 on PyPI
fastmcppermissive · top 1,000 on PyPI
typerpermissive · top 1,000 on PyPI