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 evohome-async to 0.4.4 #103084

Merged
merged 29 commits into from Nov 6, 2023
Merged

Bump evohome-async to 0.4.4 #103084

merged 29 commits into from Nov 6, 2023

Conversation

zxdavb
Copy link
Contributor

@zxdavb zxdavb commented Oct 30, 2023

Proposed change

This PR upgrades the evohome client library (evohome-async) and makes the minimum necessary changes to the integration codebase so that existing functionality is preserved.

The differences between the old library, and the refactored library are quite extensive: zxdavb/evohome-async@0.3.15...0.4.4

  • abstract all builtin/aiohttp exceptions with library-specific exceptions
  • harden code, refactor namespace for consistency, use constants instead of literals
  • adds tests via pytest, use voluptuous for validation of JSON
  • passes a default mypy check, switch from black to ruff
  • switch to pyproject.toml & hatch & move to CI/CD via github actions
  • bug fixes (e.g. exposed by mypy)

In particular, the client library no longer raises generic exceptions (e.g. KeyError, aiohttp.ClientResponseError) and instead raises its own exceptions (e.g. evo.exceptions.AuthenticationFailed).

This PR is expected to be the first of a sequence of such to improve the code quality of evohome, such as type hints, and to eventually add in config flow.

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 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:

@zxdavb zxdavb changed the title WIP: Evohome: bump library and remove generic exceptions Evohome: bump library and remove generic exceptions Nov 1, 2023
@zxdavb zxdavb marked this pull request as ready for review November 1, 2023 15:52
@zxdavb zxdavb marked this pull request as draft November 1, 2023 15:57
@zxdavb zxdavb changed the title Evohome: bump library and remove generic exceptions WIP: Evohome: bump library and remove generic exceptions Nov 1, 2023
@zxdavb zxdavb changed the title WIP: Evohome: bump library and remove generic exceptions Evohome: bump library and remove generic exceptions Nov 1, 2023
@zxdavb zxdavb marked this pull request as ready for review November 1, 2023 17:34
@jbouwh
Copy link
Contributor

jbouwh commented Nov 4, 2023

What this integration needs is a config entry indeed and tests.
Big question here is where this a breaking change for the current users. Do they notice anything we should mention?

@zxdavb
Copy link
Contributor Author

zxdavb commented Nov 4, 2023

What this integration needs is a config entry indeed and tests.

Yes - the goal is to add config entry. Will need to refactor the broker first (see: #79869).

Big question here is where this a breaking change for the current users. Do they notice anything we should mention?

There are no breaking changes for the user (as indicated above), except that thrown exceptions will be different (different name, message). The messages with the exceptions are more helpful.

Specifically, there are no mention of the exceptions in the docs, so nothing to update.

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

LGTM,
Thnx @zxdavb 👍

@MartinHjelmare MartinHjelmare changed the title Evohome: bump library and remove generic exceptions Bump evohome-async to 0.4.3 Nov 4, 2023
@zxdavb zxdavb changed the title Bump evohome-async to 0.4.3 Bump evohome-async to 0.4.4 Nov 5, 2023
@zxdavb
Copy link
Contributor Author

zxdavb commented Nov 5, 2023

Client library bumped to 0.4.4 - no changes to integration, other than manifest.json.

Change include:

  • rename evo.NoDefaultTcsError as evo.NoSingleTcsError
  • replace builtin.NotImplementedError with evo.DeprecationError
  • improve mypy type hinting
  • bug fixes, extend voluptuous schemas for edge cases
  • add to test suites - harden existing tests

@zxdavb
Copy link
Contributor Author

zxdavb commented Nov 6, 2023

TL;DR: Can I Merge this?

I have read the Perfect PR recommendations, but the next steps are not clear to me...

This PR has been reviewed, and passes all tests.

Specifically, can I press this button I see: Squash and merge, or is that not allowed?

I have another PR queued up, is all.

If this question is inappropriate, please let me know (gently).

@jbouwh
Copy link
Contributor

jbouwh commented Nov 6, 2023

TL;DR: Can I Merge this?

I have read the Perfect PR recommendations, but the next steps are not clear to me...

This PR has been reviewed, and passes all tests.

Specifically, can I press this button I see: Squash and merge, or is that not allowed?

I have another PR queued up, is all.

If this question is inappropriate, please let me know (gently).

I'll merge it after the CI tests pass

@jbouwh jbouwh merged commit 3cfb2d5 into home-assistant:dev Nov 6, 2023
53 checks passed
@zxdavb zxdavb deleted the evo_new_library branch November 6, 2023 12:20
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 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.

None yet

2 participants