Skip to content

Migrate to serialx#443

Open
bouwew wants to merge 9 commits intomainfrom
serialx
Open

Migrate to serialx#443
bouwew wants to merge 9 commits intomainfrom
serialx

Conversation

@bouwew
Copy link
Copy Markdown
Contributor

@bouwew bouwew commented Apr 28, 2026

Summary by CodeRabbit

  • Chores

    • Version bumped to 0.47.7a0 (pre-release)
    • Updated serial communication dependency to a new transport implementation
  • Documentation

    • Added an "Ongoing" section at the top of the changelog listing current work items
  • Tests

    • Test requirements updated to use the new serial transport package

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@bouwew has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 34 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bae0ea70-f123-42ef-ae2f-7745a53febfc

📥 Commits

Reviewing files that changed from the base of the PR and between cbcbd58 and e646b2e.

📒 Files selected for processing (4)
  • .github/workflows/merge.yml
  • .github/workflows/verify.yml
  • plugwise_usb/connection/manager.py
  • pyproject.toml
📝 Walkthrough

Walkthrough

Migrates async serial handling from pyserial-asyncio-fast/serial to serialx; updates dependencies and version, adjusts imports in connection modules, removes explicit serial parameterization from connection creation, and broadens exception handling in the connection manager. (≈33 words)

Changes

Cohort / File(s) Summary
Dependency & metadata
pyproject.toml, requirements_test.txt, CHANGELOG.md
Bumps package to 0.47.7a0; replaces pyserial-asyncio-fast with serialx in project and test deps; adds an "Ongoing" entry to CHANGELOG.md.
Connection manager
plugwise_usb/connection/manager.py
Swaps imports to serialx; create_serial_connection call no longer passes explicit bytesize/stopbits/parity/xonxoff; expands caught exceptions to FileNotFoundError, OSError, TimeoutError, TypeError, ValueError and rethrows as StickError.
Receiver import
plugwise_usb/connection/receiver.py
Changes SerialTransport import source from serial_asyncio_fast to serialx; no other logic change.
Package init change
plugwise_usb/connection/__init__.py
Minor exception handling syntax change in send (adjusted exception tuple/comma usage) with same behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • V0.44.9 release #300 — Related changes to release metadata and versioning touching CHANGELOG.md and pyproject.toml.

Suggested reviewers

  • dirixmjm
  • ArnoutD
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Migrate to serialx' directly and clearly summarizes the main objective of the changeset, which involves replacing pyserial-asyncio-fast with serialx across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch serialx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 21 minutes and 34 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested review from ArnoutD and dirixmjm April 28, 2026 17:15
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.78%. Comparing base (63ea14f) to head (e646b2e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
+ Coverage   81.76%   81.78%   +0.01%     
==========================================
  Files          36       36              
  Lines        8195     8192       -3     
==========================================
- Hits         6701     6700       -1     
+ Misses       1494     1492       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pyproject.toml (1)

7-7: Consider aligning development-status classifier with prerelease version.

Line 7 sets an alpha version (0.47.7a0), while Line 11 still declares Production/Stable. Consider switching classifier during prerelease cycles to avoid metadata ambiguity.

📦 Optional metadata alignment
-    "Development Status :: 5 - Production/Stable",
+    "Development Status :: 3 - Alpha",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` at line 7, The package metadata declares a prerelease version
string ("version = \"0.47.7a0\"") but the classifiers still indicate a
production/stable release; update the Development Status classifier to match an
alpha prerelease (for example change "Development Status :: 5 -
Production/Stable" to "Development Status :: 3 - Alpha" or similar) so the
metadata aligns with the prerelease version; locate the classifiers block in
pyproject.toml and replace the Production/Stable entry with the appropriate
prerelease classifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Line 5: Replace the empty PR link placeholder "PR []()" in CHANGELOG.md with a
proper markdown link or remove it: update the text to include the actual PR
number and URL (e.g., PR [`#123`](https://github.com/owner/repo/pull/123)) or
simply remove the empty link so the line becomes a valid sentence; ensure no
remaining "[]()" token remains in the file.

In `@plugwise_usb/connection/manager.py`:
- Line 10: The call site that invokes create_serial_connection (the block
currently translating SerialException/TimeoutError to StickError around the
exception mapping for SerialException in manager.py) must defensively translate
all invalid-URL related errors into StickError; update the exception handling
around create_serial_connection so it catches SerialException, TimeoutError,
TypeError, ValueError and a broad Exception fallback from
create_serial_connection and re-raises a StickError with the original exception
attached (preserving current behavior for SerialException/TimeoutError),
ensuring functions like create_serial_connection and SerialTransport creation
never leak dependency-specific exceptions outside (refer to the exception
mapping currently around create_serial_connection/SerialTransport in
manager.py).

---

Nitpick comments:
In `@pyproject.toml`:
- Line 7: The package metadata declares a prerelease version string ("version =
\"0.47.7a0\"") but the classifiers still indicate a production/stable release;
update the Development Status classifier to match an alpha prerelease (for
example change "Development Status :: 5 - Production/Stable" to "Development
Status :: 3 - Alpha" or similar) so the metadata aligns with the prerelease
version; locate the classifiers block in pyproject.toml and replace the
Production/Stable entry with the appropriate prerelease classifier.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d183932-6ffd-4bcb-8b9d-9f850fec8ba9

📥 Commits

Reviewing files that changed from the base of the PR and between 63ea14f and 7356241.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • plugwise_usb/connection/manager.py
  • plugwise_usb/connection/receiver.py
  • pyproject.toml
  • requirements_test.txt
  • tests/test_usb.py

Comment thread CHANGELOG.md Outdated
Comment thread plugwise_usb/connection/manager.py Outdated
@bouwew bouwew marked this pull request as ready for review April 28, 2026 17:34
@bouwew bouwew requested a review from a team as a code owner April 28, 2026 17:34
Copy link
Copy Markdown
Contributor

@ArnoutD ArnoutD left a comment

Choose a reason for hiding this comment

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

The read: https://developers.home-assistant.io/blog/2026/04/27/pyserial-to-serialx/

Furthermore works functional as is.. but it does seem to eat quite some cpu, and I see more no answer within 15s

Comment thread plugwise_usb/connection/manager.py Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
plugwise_usb/connection/manager.py (1)

137-143: ⚠️ Potential issue | 🟠 Major

Catch OSError to preserve the StickError boundary for serial-open failures.

Line 138 only catches FileNotFoundError; other open failures (e.g., permission/IO errors) can still leak as raw OSError subclasses instead of being normalized to StickError.

Suggested patch
-        except (
-            FileNotFoundError,
-            SerialException,
-            TimeoutError,
-            TypeError,
-            ValueError,
-        ) as err:
+        except (
+            OSError,
+            SerialException,
+            TimeoutError,
+            TypeError,
+            ValueError,
+        ) as err:
             raise StickError(
                 f"Failed to open serial connection to {serial_path}"
             ) from err
In serialx, what exceptions can create_serial_connection(...) raise when opening an invalid/unavailable serial URL (missing device, permission denied, malformed path)? Please include whether these are OSError subclasses.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugwise_usb/connection/manager.py` around lines 137 - 143, The except block
that currently catches (FileNotFoundError, SerialException, TimeoutError,
TypeError, ValueError) should also include OSError so serial-open failures
(permission/IO/malformed paths) are normalized to the StickError boundary;
update the tuple in the except (...) as err clause (the handler that raises or
wraps into StickError) to add OSError, ensuring the same error path is followed
for create_serial_connection/open attempts and preserve the StickError semantics
used elsewhere in the manager (refer to the existing SerialException and
StickError handling).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@plugwise_usb/connection/manager.py`:
- Around line 137-143: The except block that currently catches
(FileNotFoundError, SerialException, TimeoutError, TypeError, ValueError) should
also include OSError so serial-open failures (permission/IO/malformed paths) are
normalized to the StickError boundary; update the tuple in the except (...) as
err clause (the handler that raises or wraps into StickError) to add OSError,
ensuring the same error path is followed for create_serial_connection/open
attempts and preserve the StickError semantics used elsewhere in the manager
(refer to the existing SerialException and StickError handling).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 414fe56d-1730-4dc1-89ba-badfcde3273d

📥 Commits

Reviewing files that changed from the base of the PR and between 7356241 and d28f7f0.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • plugwise_usb/connection/manager.py
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugwise_usb/connection/__init__.py`:
- Line 237: The except clause in send() uses invalid Python-2 syntax "except
NodeError, StickError:"; change it to the Python-3 tuple form by using "except
(NodeError, StickError):" (and add an exception variable like "as e" if the
block references the exception). Update the except block around send() to catch
(NodeError, StickError) so the module imports cleanly and any referenced
exception variable inside the block continues to work.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7ff14a2-c51c-4b4d-8967-6b2eb49701e0

📥 Commits

Reviewing files that changed from the base of the PR and between d28f7f0 and cbcbd58.

📒 Files selected for processing (2)
  • plugwise_usb/connection/__init__.py
  • plugwise_usb/connection/manager.py

Comment thread plugwise_usb/connection/__init__.py Outdated
@sonarqubecloud
Copy link
Copy Markdown

@bouwew bouwew deployed to testpypi April 29, 2026 18:13 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants