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

Bump roombapy to 1.6.12 #110762

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

mib1185
Copy link
Contributor

@mib1185 mib1185 commented Feb 16, 2024

Proposed change

release-notes: https://github.com/pschmitt/roombapy/releases/tag/1.6.12
diff: pschmitt/roombapy@1.6.10...1.6.12

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

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:

@home-assistant
Copy link

Hey there @pschmitt, @cyr-ius, @shenxn, @Xitee1, mind taking a look at this pull request as it has been labeled with an integration (roomba) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of roomba 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 roomba Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@mib1185
Copy link
Contributor Author

mib1185 commented Feb 16, 2024

mehhh ... pydantic conflict 🙄

@mib1185 mib1185 marked this pull request as draft February 16, 2024 23:11
@joostlek
Copy link
Member

Lovely. They either should make it work with Pydantic V1 and support v2 via shims. (Since I'm trying to get HA to migrate to V2 safely, I don't think it's a good idea to accept new dependencies with Pydantic V1 without support for working with v2 (using the included shims)). Or they should move away completely to another lib like mashumaro. I'll try to find some time to help with this since I'm also a Roomba user :)

@Orhideous
Copy link
Contributor

Orhideous commented Feb 17, 2024

@joostlek I'll open follow-up PR to roombapy in a next few hours, thanks for pointing this. So, which version of Pydantic should library target for? Found #99218.

@Orhideous
Copy link
Contributor

Orhideous commented Feb 17, 2024

Well, in a new patch version it should work with Pydantic v1 and v2, added some tests for this.

UPD: @mib1185 1.6.12 is already available :)

homeassistant/components/roomba/manifest.json Outdated Show resolved Hide resolved
requirements_all.txt Outdated Show resolved Hide resolved
requirements_test_all.txt Outdated Show resolved Hide resolved
@joostlek joostlek changed the title Bump roombapy to 1.6.11 Bump roombapy to 1.6.12 Feb 20, 2024
@joostlek joostlek marked this pull request as ready for review February 20, 2024 17:39
Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

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

Tests are failing, can you take a look?

@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.

@home-assistant home-assistant bot marked this pull request as draft February 20, 2024 22:12
@Orhideous
Copy link
Contributor

Orhideous commented Feb 20, 2024

It's due to stricter invariants in roombapy now. I'd like to enforce strict typing in this integration soon.

Here is a patch for test_roomba_integration.py that should fix tests.

-   roomba = RoombaInfo(
-       hostname="irobot-BLID",
-       robot_name="robot_name",
-       ip=MOCK_IP,
-       mac="mac",
-       firmware="firmware",
-       sku="sku",
-       capabilities="capabilities",
-   )
+   roomba = RoombaInfo(
+       hostname="irobot-BLID",
+       robotname="robot_name",
+       ip="1.2.3.4",
+       mac="mac",
+       sw="firmware",
+       sku="sku",
+       cap={"capability": 1},
+   )

@joostlek
Copy link
Member

We can enable strict typing in a follow up, but this PR now breaks some tests, that should be fixed first.

@joostlek
Copy link
Member

Also, please don't forget to add a py.typed file for enabling mypy to read types from the lib. https://peps.python.org/pep-0561/

@Orhideous
Copy link
Contributor

Sure, I hope to finish polishing the library and integration for the next release. But this PR isn't mine, so I can only help with the patch.
Might be worth opening the next PR myself, just to be sure.

@Orhideous Orhideous mentioned this pull request Feb 21, 2024
20 tasks
@mib1185
Copy link
Contributor Author

mib1185 commented Feb 21, 2024

Tests are failing, can you take a look?

i'm not familiar with pydantic so i'm not sure what is wrong here or which side needs to be adjusted

error

tests/components/roomba/test_config_flow.py:99: in _mocked_discovery
    roomba = RoombaInfo(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>   ???
E   pydantic.error_wrappers.ValidationError: 3 validation errors for RoombaInfo
E   sw
E     field required (type=value_error.missing)
E   robotname
E     field required (type=value_error.missing)
E   cap
E     field required (type=value_error.missing)

tests/components/roomba/test_config_flow.py

def _mocked_discovery(*_):
    roomba_discovery = MagicMock()

    roomba = RoombaInfo(
        hostname="irobot-BLID",
        robot_name="robot_name",
        ip=MOCK_IP,
        mac="mac",
        firmware="firmware",
        sku="sku",
        capabilities={"cap1": 1},
    )

roombapy/roomba_info.py

class RoombaInfo(BaseModel):
    hostname: str
    firmware: str = Field(alias="sw")
    ip: str
    mac: str
    robot_name: str = Field(alias="robotname")
    sku: str
    capabilities: Dict[str, int] = Field(alias="cap")
    password: Optional[str] = None

EDIT: when using the "alias" names for the properties, than it works

def _mocked_discovery(*_):
    roomba_discovery = MagicMock()

    roomba = RoombaInfo(
        hostname="irobot-BLID",
        robotname="robot_name",
        ip=MOCK_IP,
        mac="mac",
        sw="firmware",
        sku="sku",
        cap={"cap1": 1},
    )

that's weird 🤨

@mib1185 mib1185 marked this pull request as ready for review February 21, 2024 16:43
@home-assistant home-assistant bot requested a review from joostlek February 21, 2024 16:43
@joostlek joostlek merged commit 9348f99 into home-assistant:dev Feb 22, 2024
53 checks passed
@mib1185 mib1185 deleted the roomba/bump-roombapy-to-1.6.11 branch February 22, 2024 10:17
frenck pushed a commit that referenced this pull request Feb 22, 2024
* bump roombapy to 1.6.11

* Apply suggestions from code review

* "fix" tests (make them pydantic fiendly?)

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
@frenck frenck mentioned this pull request Feb 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 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.

Cannot add Roomba Integration for J5+ Combo
5 participants