backports.cached-property
cached_property() - computed once per instance, cached as attribute
What it is and what it does
This package backports Python 3.8's cached_property descriptor to Python 3.6 and 3.7. It lets you decorate a method so its result is computed once and then stored as a regular instance attribute, avoiding recomputation on subsequent accesses. The decorator is useful for expensive computed properties that don't change during an instance's lifetime.
The implementation is minimal and closely follows Python 3.8's standard library version. It depends only on the typing module and installs as a single wheel with low friction. However, it has a known limitation: it requires instances to have a mutable __dict__ attribute, so it won't work with classes that define __slots__ without including __dict__, or with metaclasses.
Use it for:
- Add caching to expensive statistical computations in data analysis classes.
- Backport cached_property to legacy codebases still running Python 3.6 or 3.7.
- Cache derived attributes in immutable-like objects where recomputation is wasteful.
- Simplify property definitions when you need both lazy evaluation and memoization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides the cached_property decorator for Python 3.6 and 3.7, allowing methods to be computed once per instance and cached as attributes.
Yes, if you need cached_property on Python 3.6 or 3.7. The package is stable, permissively licensed, and has no known vulnerabilities. Dormant maintenance is acceptable here because the backport targets a fixed API from Python 3.8—there is little reason for it to change. If you are already on Python 3.8+, use the standard library instead.
Install
backports-cached-property on PyPI
pip
pip install backports-cached-propertyuv
uv add backports-cached-propertypoetry
poetry add backports-cached-propertyInstalling backports.cached-property
Before you install
Low install friction with a single wheel dependency. Maintenance is dormant—last release was 2022-06-14 and no commits since 2023-11-22—but the package is marked Production/Stable and addresses a narrow, stable backport use case.
License in practice
MIT License (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install backports.cached-property
from backports.cached_property import cached_property
class DataSet:
@cached_property
def stdev(self):
return statistics.stdev(self._data)
Requires Python 3.6 or later. Does not work with classes using __slots__ without __dict__, or with metaclasses.
Verify before relying
- Whether dormant maintenance (last commit 2023-11-22) poses a risk for future Python versions beyond 3.9.
- Real-world performance impact of caching overhead versus computation savings in typical use cases.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.6.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing |
| Maintenance | dormant — 1,522 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 509,434/month — #6,271 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: backports.cached_property-1.0.2-py3-none-any.whl
Keywords: caching, development
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
lazyProvides a @lazy decorator that defers…
permissive · top 15,000 on PyPI
property-managerProvides custom Python property decorators for…
permissive · top 15,000 on PyPI
zope.cachedescriptorsProvides decorator-based caching for computed…
unclear · top 15,000 on PyPI
propcacheProvides fast cached-property decorators for…
permissive · top 100 on PyPI
cached_methodProvides a method-level caching decorator that…
permissive · top 15,000 on PyPI
async-propertyProvides Python decorators (@async_property and…
permissive · top 5,000 on PyPI
backports.functools-lru-cacheProvides the lru_cache decorator from Python…
permissive · top 5,000 on PyPI
django-cache-memoizeA decorator that caches function results using…
copyleft · top 15,000 on PyPI