Skip to content

feat(python): AsyncSerialMonitor scaffold via pyo3-async-runtimes (partial #65)#73

Merged
zackees merged 1 commit intomainfrom
feat/issue-65-async-serial-monitor
Apr 17, 2026
Merged

feat(python): AsyncSerialMonitor scaffold via pyo3-async-runtimes (partial #65)#73
zackees merged 1 commit intomainfrom
feat/issue-65-async-serial-monitor

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 17, 2026

Summary

Partial progress on #65. Lays the async Python API foundation so future work can migrate methods incrementally rather than landing a single sweeping refactor.

  • Adds `pyo3-async-runtimes = 0.22` with the `tokio-runtime` feature.
  • Introduces `AsyncSerialMonitor` as a new pyclass alongside the existing sync `SerialMonitor`. The async class is purely additive — no change to the sync API.
  • Exposes `async reset_device(board=None)` as the first native-async method. Reset is stateless (pure HTTP), so it ports cleanly without needing to refactor the WebSocket state machine first.

Follow-up (tracked in #65)

The WebSocket-backed methods (`read_lines`, `write`, `write_json_rpc`, `aenter/aexit`) need the shared WebSocket state to be `Send + Sync` across `await` points before they can be exposed as async. That refactor is the bulk of remaining work on this issue.

Test plan

  • `cargo check -p fbuild-python` clean
  • `cargo clippy --workspace --all-targets -- -D warnings` clean
  • `cargo fmt --all -- --check` clean
  • Runtime smoke test (requires built `.pyd` via `maturin develop`; CI covers this when it builds the native module)

🤖 Generated with Claude Code

Partial progress on #65. Lays the async Python API foundation:

- Add pyo3-async-runtimes = 0.22 with the tokio-runtime feature.
- Introduce AsyncSerialMonitor as a new pyclass alongside the existing
  sync SerialMonitor. The async class is purely additive — no change
  to the sync API.
- Expose `async reset_device(board=None)` as the first native-async
  method. Reset is stateless (pure HTTP) so it ports cleanly without
  needing to refactor the WebSocket state machine first.

Future work: migrate read_lines, write, and write_json_rpc as the
shared WebSocket state is refactored to be Send + Sync across await
points.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Warning

Rate limit exceeded

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

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 30 minutes and 13 seconds.

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 146994f3-bf16-4d51-90e3-7151dc2fe260

📥 Commits

Reviewing files that changed from the base of the PR and between accb967 and 7d88f3a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • crates/fbuild-python/Cargo.toml
  • crates/fbuild-python/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-65-async-serial-monitor

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

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

@zackees zackees merged commit e3fa524 into main Apr 17, 2026
76 checks passed
@zackees zackees deleted the feat/issue-65-async-serial-monitor branch April 17, 2026 21:28
zackees added a commit that referenced this pull request Apr 17, 2026
Next incremental step on #65 (native async API). Adds AsyncDaemon as a
counterpart to the sync Daemon class, mirroring the AsyncSerialMonitor
pattern from PR #73.

- AsyncDaemon is purely additive — the sync Daemon class keeps all
  its methods and behavior.
- Exposes async status() as the first method. Like reset_device on
  AsyncSerialMonitor, status is stateless HTTP so it ports without
  needing the cross-await state refactor.

Future work on #65: async ensure_running(), async stop(), and then the
WebSocket-backed AsyncSerialMonitor methods once the shared state is
Send + Sync across await points.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zackees added a commit that referenced this pull request Apr 17, 2026
Next incremental step on #65 (native async API). Adds AsyncDaemon as a
counterpart to the sync Daemon class, mirroring the AsyncSerialMonitor
pattern from PR #73.

- AsyncDaemon is purely additive — the sync Daemon class keeps all
  its methods and behavior.
- Exposes async status() as the first method. Like reset_device on
  AsyncSerialMonitor, status is stateless HTTP so it ports without
  needing the cross-await state refactor.

Future work on #65: async ensure_running(), async stop(), and then the
WebSocket-backed AsyncSerialMonitor methods once the shared state is
Send + Sync across await points.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant