pySerial provides a unified Python API for opening, configuring, and communicating over serial ports on Windows, macOS, Linux, and BSD.
Overview
pySerial encapsulates host serial port access for Python programs. The top-level serial module selects an appropriate platform backend automatically so application code can stay portable across operating environments.
The API covers opening ports, setting parameters after connect, read and write operations, timeouts, and utilities such as miniterm for interactive terminal sessions. Documentation describes threading support, asyncio integration, and URL-style handlers for special connection types including TCP bridges, loopback, and RFC 2217 remote serial.
Installation is typically via pip, with conda-forge builds for Linux, macOS, and Windows noted in project docs. Windows installer packages are also mentioned. Examples and unit tests ship with the package for reference implementations of common patterns.
The library targets developers building hardware interfaces, industrial equipment tools, embedded debug consoles, and serial-to-IP bridges without writing separate native code per platform.
Key features
- Cross-platform serial backends
- Port configuration and timeouts
- threading support
- asyncio integration
- RFC 2217 and socket URLs
- serial.tools.list_ports
- miniterm interactive tool
- pip and conda installation
Use cases
- Microcontroller USB serial debug
- Industrial device communication
- Serial-to-TCP bridging
- Hardware test automation
- Interactive serial consoles