Skip to content

feat(python): native async API via pyo3-async-runtimes (AsyncSerialMonitor, AsyncDaemon) #65

@zackees

Description

@zackees

Split out from #18 item 3.

Problem

The Python bindings in fbuild-python expose only synchronous methods. FastLED's FbuildSerialAdapter._run_in_thread wraps every call in a thread executor so async callers don't block their event loop, but this generates an asyncio warning under some configurations and adds latency.

Proposed fix

Add AsyncSerialMonitor, AsyncDaemon, etc. that use pyo3-async-runtimes to expose async def-callable methods directly under asyncio.run(...).

  • Existing sync SerialMonitor / Daemon / DaemonConnection stay for backward compatibility.
  • New async classes are purely additive.

Scope

  • Add pyo3-async-runtimes (or successor) to crates/fbuild-python/Cargo.toml.
  • Wrap each long-running operation (serial read/write, send_op) as an async method on a new class.
  • Tests verify asyncio.run(...) works and does not spin up an extra thread pool.

Non-goals

  • Migrating or deprecating the sync API. Sync stays.

Context

Filed during the issue consolidation that closed tracker #18. See #18 for the original framing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions