--- id: backports-cached-property version: "1.0.2" license: MIT License license_treatment: permissive maintenance: dormant --- # backports.cached-property — cached_property() - computed once per instance, cached as attribute License: permissive · Maintenance: dormant · Downloads: 509.4K/mo ## 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 above — 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 pip install backports-cached-property uv add backports-cached-property poetry add backports-cached-property ## Installing 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_current - Install friction: low - Maintenance: dormant - Downloads: 509.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags cached property decorator, property caching python, computed property memoization, backport cached_property, instance attribute caching, expensive computation caching, backport, performance-optimization [View on SkillFed](https://skillfed.io/packages/backports-cached-property) · [View on PyPI](https://pypi.org/project/backports-cached-property/)