Skip to content

Replace rez.utils.data_utils.cached_property with functools.cached_property #1637

Open
@JeanChristopheMorinPerso

Description

Now that we dropped support for Python 2, we should take a look at if we can replace rez.utils.data_utils.cached_property with functools.cached_property.

rez.utils.data_utils.cached_property has multiple issues, one of which is that sphinx doesn't recognize the wrapped function as a property, see https://rez.readthedocs.io/en/stable/api/rez.system.html#rez.system.System.platform. On top of that, I don't think it's type hint friendly.

Python now has a built-in cached_property in the functools module.

Things to take into consideration:

  • Our version has an uncache method. Is it something we need?
  • Would functools.cached_property be slower or faster than what we have today? Slower would mean that we would need to find a way to make Sphinx recognize cached properties correctly.

This is at the very core of rez, so we have to be careful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions