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

Patch service validation in Aussie Broadband #99077

Merged
merged 12 commits into from
Aug 31, 2023

Conversation

Bre77
Copy link
Contributor

@Bre77 Bre77 commented Aug 26, 2023

Proposed change

The library pyAussieBB now requries Pydantic v2, which Home Assistant does not support, so we are not longer able to update the library to address issues or add service types. #99218

So to fix #95665, an override has been implemented in this PR.

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

yaleman/pyaussiebb@v0.0.15...v0.1.1

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 Black (black --fast 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:

@home-assistant
Copy link

Hey there @nickw444, mind taking a look at this pull request as it has been labeled with an integration (aussie_broadband) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of aussie_broadband can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign aussie_broadband Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@yaleman
Copy link
Contributor

yaleman commented Aug 26, 2023

I'm releasing 0.1.2 to bump the pydantic version to a 2.0 minimum, which should sort the tests.

@joostlek
Copy link
Member

@yaleman, I'm no expert on this field, but there was a discussion about pydantic 2. A lot of libraries are solving it like https://github.com/AngellusMortis/pyunifiprotect/pull/297 did. Maybe it can help?

@yaleman
Copy link
Contributor

yaleman commented Aug 27, 2023

I'm not rewriting my module to go back to the old version, sorry. If hass supports specifying a branch/tag as a requirement I'll backport the fix, or you could patch the old version after import by overriding the affected class method (it's just a check for "known-valid" service types.)

@joostlek
Copy link
Member

I discussed this with someone else and the problem is that currently HA only runs Pydantic v1. The bad news is that we can't add libraries that run only with Pydantic v2. As it will break the libraries still running with v1.

You can see integration owners have started updating libraries with the v1 shims (as you can see in the PR I linked). We didn't have much pressure to upgrade. In the coming time I will try to migrate the rest of the libraries so we can safely bump pydantic to v2.

@yaleman
Copy link
Contributor

yaleman commented Aug 29, 2023

Fixed without having to use pydantic 2.x - just patching the "broken" code in the 0.0.15 release.

@Bre77 Bre77 changed the title Bump pyAussieBB in Aussie Broadband Patch service validation in Aussie Broadband Aug 30, 2023
@Bre77 Bre77 marked this pull request as ready for review August 30, 2023 03:47
@MartinHjelmare
Copy link
Member

@yaleman would you consider backporting this fix to a 0.0.x version of the library?

@yaleman
Copy link
Contributor

yaleman commented Aug 30, 2023

I'd rather not spend any more time chasing fixes specific to Home Assistant especially when there's a fixed version already available, and this PR fixes your issue.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Please also add a test that fails if we start using pydantic 2+ in Home Assistant.

@home-assistant home-assistant bot marked this pull request as draft August 30, 2023 08:32
@home-assistant
Copy link

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.

@Bre77 Bre77 marked this pull request as ready for review August 30, 2023 23:50
@home-assistant home-assistant bot marked this pull request as draft August 31, 2023 04:50
@Bre77 Bre77 marked this pull request as ready for review August 31, 2023 05:36
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare MartinHjelmare added this to the 2023.9.0 milestone Aug 31, 2023
@MartinHjelmare MartinHjelmare merged commit e08661d into home-assistant:dev Aug 31, 2023
bramkragten pushed a commit that referenced this pull request Aug 31, 2023
* Bump pyAussieBB

* rolling back to previous version

* patching the pydantic 2.x issue in aussie_broadband integration

* adding test for validate_service_type

* adding test for validate_service_type

* fixing tests, again

* adding additional test

* doing fixes for live tests

* Implement Feedback

* Add test to detect pydantic2

* Update test_init.py

* Update docstring

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2023
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.

AussieBroadBand Fails
5 participants