serialx
Serial library with native sync and async support for Windows, Linux, macOS, and other platforms
What it is and what it does
Serialx is a cross-platform serial communication library that unifies synchronous and asynchronous APIs for Python on Linux, macOS, and Windows. It offers multiple usage patterns: a familiar synchronous context-manager interface, a native async equivalent, asyncio StreamReader/StreamWriter pairs, and low-level protocol transports for advanced consumers. The library handles modem pin state queries and control, and integrates with ESPHome for communicating with remote serial devices through the ESPHome API.
The package targets developers who need reliable serial I/O without platform-specific code paths. Its three runtime dependencies (typing-extensions, async-timeout, pywin32) are lightweight and widely maintained. The library is actively maintained with recent releases and no known security vulnerabilities.
Use it for:
- Building cross-platform embedded device communication tools that work identically on Windows, macOS, and Linux without conditional imports.
- Integrating ESPHome-exposed serial devices into Python applications via the serialx ESPHome transport layer.
- Migrating legacy pyserial code to async/await patterns while maintaining synchronous fallback support.
- Implementing protocol handlers that need low-level asyncio transport control for serial devices.
- Controlling modem pins (RTS, DTR) on serial devices for handshake and reset sequences.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Serialx provides synchronous and native asynchronous APIs for serial port communication across Linux, macOS, and Windows, with support for modem pin control and ESPHome device integration.
Yes. Serialx is actively maintained, has no security vulnerabilities, low install friction, and offers a modern dual sync/async API for serial communication across all major platforms. It is suitable for new projects and for migrating from older serial libraries. The permissive Apache-2.0 license poses no restrictions.
Install
serialx on PyPI
pip
pip install serialxuv
uv add serialxpoetry
poetry add serialxInstalling serialx
Before you install
Low install friction with a pure-wheel distribution. Active maintenance with a recent release 63 days ago. Requires Python 3.10 or later and depends on typing-extensions, async-timeout, and pywin32 (Windows-specific).
License in practice
Licensed under Apache-2.0 (permissive), allowing use in both open-source and proprietary projects with minimal restrictions beyond attribution and liability disclaimers.
Quickstart
import serialx
with serialx.serial_for_url("/dev/serial/by-id/port", baudrate=115200) as serial:
data = serial.readexactly(5)
serial.write(b"test")
Requires Python 3.10 or later; on macOS and Windows, a Rust toolchain is needed to build the native serial port enumeration extension.
Verify before relying
- Whether the Rust toolchain requirement applies to end-users installing from wheels or only to developers building from source.
- Performance characteristics and throughput limits compared to other serial libraries in common use.
- Stability and maturity level given the package's first release was in 2025-11-24.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — typing-extensions, async-timeout, pywin32 |
| Maintenance | actively maintained — 63 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 155,142/month — #10,831 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: serialx-1.8.2-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
aioesphomeapiAsync Python client library for communicating…
permissive · top 5,000 on PyPI
aioserialProvides async/await serial port I/O using…
copyleft · top 15,000 on PyPI
pyserial-asyncioAdds async/await support to pyserial for…
permissive · top 15,000 on PyPI
pexpect-serialExtends pexpect to work with serial ports by…
permissive · top 15,000 on PyPI
async-modbusAsync ModBus provides an asynchronous Python…
unclear · top 15,000 on PyPI
Adax-localA Python library for local communication with…
permissive · top 15,000 on PyPI
pyserial-asyncio-fastProvides async I/O support for serial port…
permissive · top 15,000 on PyPI
xmodemImplements the XMODEM file transfer protocol…
permissive · top 15,000 on PyPI
binho-host-adapterControls Binho Multi-Protocol USB Host Adapters…
permissive · top 15,000 on PyPI
pymodbusPyModbus is a complete Modbus protocol…
permissive · top 5,000 on PyPI