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

Add support for Python 3.13 #129442

Merged
merged 7 commits into from
Nov 10, 2024
Merged

Add support for Python 3.13 #129442

merged 7 commits into from
Nov 10, 2024

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Oct 29, 2024

Breaking change

The profiler.memory service is not available when using Python 3.13. It will return if and when guppy3 becomes Python 3.13 compatible.

Proposed change

Add initial support for Python 3.13.
The following integrations don't work yet.

PEP 594 removed a lot of "dead" batteries from the stdlib. Unfortunately, those are not quite dead yet and a lot of integrations and dependencies still use them. Fortunately there are backport libraries available which we can use instead. At some point, we might want to remove them as well, but they certainly make the transition easier.

Additional dependencies

--
For reference the Python 3.12 update:

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.

To help with the load of incoming pull requests:

@cdce8p cdce8p added breaking-change noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) and removed core labels Oct 29, 2024
@cdce8p cdce8p marked this pull request as ready for review October 30, 2024 17:14
@cdce8p
Copy link
Member Author

cdce8p commented Oct 30, 2024

The PR is ready now! Wheels will follow once the base image and wheel builder have been updated.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM, should we wait until after we ship 2024.11.0?

@edenhaus
Copy link
Contributor

LGTM, should we wait until after we ship 2024.11.0?

In my opinion, we should wait, as this PR could create potential merge conflicts with the RC

@cdce8p
Copy link
Member Author

cdce8p commented Oct 31, 2024

In my opinion, we should wait, as this PR could create potential merge conflicts with the RC

I don't think this is an issue here. All three of the integrations modified here are quite stable. There is only one PR to add a new platform to comelit which could be impacted but it's still in draft: #125154.

Overall, merge conflicts should be similar to other PRs and easy to resolve.

An alternative of course would be to just cherry-pick this one as that would completely eliminate any potential conflicts. It doesn't need to be mentioned in the release notes quite yet but users would still be able to try out 3.13 early if they want to.

@cdce8p cdce8p force-pushed the add-313 branch 3 times, most recently from 4cf892c to 532814b Compare November 4, 2024 22:57
@cdce8p
Copy link
Member Author

cdce8p commented Nov 4, 2024

tokenizers released a 3.13 compatible version today, so we no longer need to disable Anthropic. Furthermore, mediafile no longer depends on the (removed) imghdr package. So the added dependency on standard-imghdr could also be removed.

Will update the PR again tomorrow, once the (unrelated) CI issue is fixed.

@cdce8p cdce8p removed the request for review from chemelli74 November 7, 2024 18:27
@cdce8p
Copy link
Member Author

cdce8p commented Nov 7, 2024

The PR is ready now. After the pint release, we only need to disable one profiler service for Python 3.13 now. Everything else should continue to work just fine🤞🏻

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

This test seems to be failing consistently on the Python 3.13 CI right now:

CleanShot 2024-11-09 at 11 32 40@2x

../Frenck

@home-assistant home-assistant bot marked this pull request as draft November 9, 2024 10:33
@home-assistant
Copy link

home-assistant bot commented Nov 9, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@cdce8p
Copy link
Member Author

cdce8p commented Nov 9, 2024

This test seems to be failing consistently on the Python 3.13 CI right now:

CleanShot 2024-11-09 at 11 32 40@2x

Not sure yet what's going on there. The test passes locally and also on my fork. It seems to be a bit flaky. Interesting that it's only 3.13 though.

@cdce8p cdce8p mentioned this pull request Nov 9, 2024
19 tasks
@cdce8p cdce8p marked this pull request as ready for review November 9, 2024 22:04
@home-assistant home-assistant bot requested a review from frenck November 9, 2024 22:04
@cdce8p
Copy link
Member Author

cdce8p commented Nov 9, 2024

The flaky modbus test issue is now resolve.

Just pushed the last updates:

IMO this PR is ready now. The few open items (mainly Huum and eventually guppy3) can be addressed later.

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @cdce8p 🎉

Here we go 🚀

../Frenck

@frenck frenck merged commit e382f92 into home-assistant:dev Nov 10, 2024
85 of 86 checks passed
@cdce8p cdce8p deleted the add-313 branch November 10, 2024 10:40
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change cla-signed Hacktoberfest new-feature noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants