-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to using fast cached_property implementation in propcache #127339
Conversation
propcache is derived from yarl which uses an accelerated cached_property implementation. It also has an under_cached_property implementation which stores the cache in self._cache which is compatiblity with __slots__ which will allow use to restore __slots__ to many objects that we had to remove it from to allow for the stdlib @cached_property which does not support __slots__ Currently yarl and aiohttp both implement the same property caching code and cython code. The goal of the propcache library is to replace both implementations in yarl and aiohttp and maintain it in a single place in aiohttp 3.11 propcache is expected to replace the internal yarl and aiohttp implementations.
Looks like 8 is failing on all PRs https://github.com/home-assistant/core/actions/runs/11165721781/job/31038488490 so not related to this one Will give it one more try though |
Thanks @Kane610 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small thing: should we add to pylint deprecated imports so functools.cached_property not imported?
Or can be done in follow up - depends if we want to enforce throughout. |
Probably best do to in a followup 👍 |
Test failure is unrelated and generally failing on most full runs |
Proposed change
propcache
is derived fromyarl
which uses an acceleratedcached_property
implementation. It also has anunder_cached_property
implementation which stores the cache inself._cache
which is compatibility with__slots__
which will allow use to restore__slots__
to many objects that we had to remove it from to allow for the stdlib@cached_property
which does not support__slots__
in a future PR. Theunder_cached_property
implementation is whatyarl
andaiohttp
use internally ascached_property
inyarl
andreify
inaiohttp
.Currently
yarl
andaiohttp
both implement the same property caching code andcython
code. The goal of thepropcache
library is to replace both implementations inyarl
andaiohttp
and maintain it in a single place. Withaiohttp
3.11propcache
is expected to replace the internalyarl
andaiohttp
implementations.TODODonepropcache
https://github.com/Bluetooth-Devices/propcache/actions/runs/11147337668cached_property
feat: switch to using propcache cached_property to improve performance bdraco/yalexs#191 feat: switch from stdlib cached_property to propcache cached_property bdraco/cached-ipaddress#25 feat: switch to using fast cached_property from propcache uilibs/uiprotect#224propcache
to fix armv7l wheels https://github.com/Bluetooth-Devices/propcache/actions/runs/11165148663Future work (not required for this PR)
propcache
toaio-libs
Adapt aiohttp reify implementation to replace internal cached_property aio-libs/yarl#1070 (comment)yarl
Migrate to using propcache for property caching aio-libs/yarl#1169aiohttp
Migrate to using propcache for property caching aio-libs/aiohttp#9394Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: