{"id":302,"library":"propcache","title":"propcache","description":"propcache is a Python library that provides accelerated implementations of cached properties, enhancing performance for property caching in Python 3.9 and above. The current version is 0.4.1, with a release cadence that includes regular updates and bug fixes.","status":"active","version":"0.4.1","language":"python","source_language":"en","source_url":"https://github.com/aio-libs/propcache","tags":["cached_property","performance","Python"],"install":[{"cmd":"pip install propcache","lang":"bash","label":"Install propcache"}],"dependencies":[],"imports":[{"note":"propcache provides an optimized version of cached_property; using functools.cached_property will not leverage these optimizations.","wrong":"from functools import cached_property","symbol":"cached_property","correct":"from propcache import cached_property"},{"note":"under_cached_property is a unique feature of propcache and is not available in functools.","symbol":"under_cached_property","correct":"from propcache import under_cached_property"}],"quickstart":{"code":"from propcache import cached_property\n\nclass MyClass:\n    def __init__(self, value):\n        self._value = value\n\n    @cached_property\n    def computed_property(self):\n        # Expensive computation\n        return self._value * 2\n\nobj = MyClass(10)\nprint(obj.computed_property)  # Outputs: 20","lang":"python","description":"This example demonstrates how to use propcache's cached_property to cache the result of an expensive computation in a class property."},"warnings":[{"fix":"Upgrade to version 0.4.1 or later, where the issue has been resolved.","message":"Version 0.4.0 was yanked due to a reference leak caused by improper reference counting in Cython.","severity":"breaking","affected_versions":"0.4.0"},{"fix":"Ensure that self._cache is correctly initialized and managed within your class when using under_cached_property.","message":"propcache's under_cached_property uses self._cache instead of self.__dict__ to store cached values, which may lead to unexpected behavior if self._cache is not properly managed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Address pip warnings if necessary, but this is not a library-specific failure.","message":"The provided test output contains warnings from pip itself regarding running as root and available updates, which are environmental and do not indicate a failure of the library under test. No library-specific failure is described.","severity":"gotcha","affected_versions":"N/A"}],"env_vars":null,"search_vec":"'0.4.1':28 '3.9':21 'acceler':9 'bug':38 'cach':12,18,40 'cadenc':32 'current':25 'enhanc':14 'fix':39 'implement':10 'includ':34 'librari':6 'perform':15,42 'propcach':1,2 'properti':13,17,41 'provid':8 'python':5,20,43 'regular':35 'releas':31 'updat':36 'version':26","created_at":"2026-03-28T08:21:04.990171+00:00","updated_at":"2026-04-16T18:12:04.915138+00:00","problems":[{"fix":"Run `pip install propcache` to install the library.","cause":"The propcache library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'propcache'"},{"fix":"If you need to re-evaluate the property, delete the cached attribute from the instance's dictionary (e.g., `del self.__dict__['my_property']`) or the dedicated cache (`del self._cache['my_property']` for `under_cached_property`), and then access the property again. Do not attempt to assign to it directly.","cause":"You are attempting to directly assign a new value to a property decorated with `propcache.cached_property` or `propcache.under_cached_property`, which are designed to be computed once and then accessed, not directly modified after first access.","error":"AttributeError: cached property is read-only"},{"fix":"Install the required C/C++ build tools. On Windows, download and install 'Microsoft C++ Build Tools' from the provided link. On Linux, ensure `gcc` and Python development headers (e.g., `python3-dev` or `python-devel`) are installed. Alternatively, you can force a slower pure-Python installation by running `pip install propcache --config-settings=pure-python=true` or setting the environment variable `PROPCACHE_NO_EXTENSIONS=1` before installation.","cause":"propcache uses Cython for accelerated implementations, and if pre-built binary wheels are not available for your specific system/Python version, it attempts to compile from source, requiring a C compiler. This specific error occurs on Windows when the necessary build tools are missing.","error":"error: Microsoft Visual C++ 14.0 or greater is required. Get it with \"Microsoft C++ Build Tools\": https://visualstudio.microsoft.com/visual-cpp-build-tools/"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"0.5.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/aio-libs/propcache","docs":null,"changelog":null,"pypi":"https://pypi.org/project/propcache/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}