Skip to content
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

Remove unnecessary functools.cached_property backport #114239

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Mar 26, 2024

Proposed change

The last support for Python 3.11 was removed in #114220. We can now also remove the backport for functools.cached_property.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

)
raise TypeError(msg) from None
return val
from functools import cached_property
Copy link
Contributor

@edenhaus edenhaus Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do something similar to the deprecated const?

_DEPRECATED_SUPPORT_ALARM_ARM_VACATION: Final = DeprecatedConstantEnum(

__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())

Importing and using a deprecated const will create a log entry

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be possible. For now I've copied the way from backports.enum and added a new entry for the hass_imports pylint plugin.

from __future__ import annotations
from enum import StrEnum
__all__ = [
"StrEnum",
]

Would it be fine if we explore your idea after this is merged?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's fine to add it after this PR is merged. Maybe we can also add it for the enum one.
So we can remove the files et all after the deprecation period

@bdraco
Copy link
Member

bdraco commented Mar 26, 2024

Please hold off on merging until 2024.4 is released. I'm still doing testing with py3.11 until than and this would make it more difficult

@cdce8p cdce8p marked this pull request as draft March 26, 2024 15:32
@frenck
Copy link
Member

frenck commented Mar 26, 2024

I'm still doing testing with py3.11 until than and this would make it more difficult

Support for 3.11 has been merged and removed today. Not sure how this PR would help with that?

@bdraco
Copy link
Member

bdraco commented Mar 26, 2024

My test branch has reverts to keep py3.11 support so I can finish testing with py-spy through beta since py-spy doesn't work on py3.12 benfred/py-spy#633

Unfortunately this is the primary way I can catch blocking I/O in the event loop which is going to make issue a lot harder to debug after beta ends. We may end up with a time window between 3.11 and 3.13 support (which has python/cpython#106598) where these type of issues will be very difficult to debug so I'd like to fix as many as I can before than

@cdce8p cdce8p marked this pull request as ready for review April 3, 2024 20:39
@cdce8p cdce8p merged commit 816ce11 into home-assistant:dev Apr 4, 2024
37 of 38 checks passed
@cdce8p cdce8p deleted the functools-backport branch April 4, 2024 09:24
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants