{"library":"property-cached","title":"Property Cached","description":"The `property-cached` library (version 1.6.4) provides a Python decorator to cache the result of a class property's first access. Subsequent accesses to that property on the same instance retrieve the cached value without re-computation. It is a maintained fork of the original `cached-property` library, offering improved compatibility and type hinting support for modern Python versions. Releases are typically driven by bug fixes and compatibility updates.","language":"python","status":"active","last_verified":"Mon May 18","install":{"commands":["pip install property-cached"],"cli":null},"imports":["from property_cached import cached_property"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from property_cached import cached_property\nimport time\n\nclass MyResource:\n    def __init__(self, name):\n        self.name = name\n        self._heavy_computation_count = 0\n\n    @cached_property\n    def loaded_data(self):\n        print(f\"[{self.name}] Performing heavy computation for data...\")\n        time.sleep(0.1) # Simulate delay\n        self._heavy_computation_count += 1\n        return f\"Data for {self.name} (computed {self._heavy_computation_count} times)\"\n\nresource1 = MyResource(\"Resource A\")\nprint(f\"First access: {resource1.loaded_data}\")\nprint(f\"Second access: {resource1.loaded_data}\") # Will not re-compute\n\nprint(\"\\nModifying resource, then trying to access again...\")\n# If underlying state changes, the cached property remains stale\nresource1.name = \"Resource A (modified)\"\nprint(f\"Access after name change: {resource1.loaded_data}\") # Still uses old cached value\n\nprint(\"\\nDeleting cached property to force re-computation...\")\ndel resource1.loaded_data\nprint(f\"Access after deletion: {resource1.loaded_data}\") # Re-computes with new name\n","lang":"python","description":"This example demonstrates how to use `cached_property`. The `loaded_data` property will execute its computation only on the first access for a given `MyResource` instance. Subsequent accesses retrieve the cached value. It also shows how to explicitly delete a cached property to force re-computation if the underlying state changes.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-18","installed_version":"1.6.4","pypi_latest":"1.6.4","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.5,"avg_import_s":0.52,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":0.52,"mem_mb":14.8,"disk_size":"18.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":1.4,"import_time_s":0.35,"mem_mb":14.8,"disk_size":"19M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":0.73,"mem_mb":16.3,"disk_size":"20.5M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":1.5,"import_time_s":0.59,"mem_mb":16.3,"disk_size":"21M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.4,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"11.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":1.5,"import_time_s":null,"mem_mb":null,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":null,"import_time_s":0.49,"mem_mb":14.4,"disk_size":"17.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"property-cached","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"noisy","install_time_s":1.7,"import_time_s":0.44,"mem_mb":14.4,"disk_size":"18M"}]}}