uModbus
Implementation of the Modbus protocol in pure Python.
What it is and what it does
uModbus is a lightweight, pure-Python implementation of the Modbus protocol (MODBUS Application Protocol Specification V1.1b3) that lets you build Modbus clients and servers for both TCP and RTU communication modes. It handles the low-level protocol details—encoding requests, parsing responses, managing slave IDs and function codes—so you can focus on reading and writing coils and registers. The package supports function codes 01–06 and 15–16 for common operations like reading holding registers and writing multiple coils, plus signed and unsigned register values.
Typically used in industrial automation and embedded systems where devices communicate via Modbus over Ethernet (TCP) or serial links (RTU). You set up a server with route decorators that map slave IDs and addresses to your data store, or use the client API to send requests and receive responses from remote Modbus devices. The single runtime dependency is pyserial, needed only for RTU serial communication; TCP mode has no external dependencies beyond the standard library.
Use it for:
- Build a Modbus TCP server to expose sensor or control data from an embedded system or industrial device.
- Query Modbus RTU devices over serial connections to read temperature, pressure, or status registers.
- Implement a Modbus gateway that bridges TCP clients to RTU serial devices or vice versa.
- Write integration tests for Modbus-based hardware by simulating a server or client in pure Python.
- Prototype industrial automation logic without proprietary Modbus libraries or commercial tools.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
uModbus is a pure Python implementation of the Modbus protocol that provides both client and server functionality for Modbus TCP and RTU communication.
Yes, if you need Modbus protocol support in Python. The package is mature, actively maintained, has no known vulnerabilities, and low install friction. The copyleft license (MPL 2.0) is a consideration for proprietary projects; verify compatibility with your licensing requirements before use.
Install
umodbus on PyPI
pip
pip install umodbusuv
uv add umodbuspoetry
poetry add umodbusInstalling uModbus
Before you install
Low install friction with a single runtime dependency (pyserial). The package is actively maintained with recent commits and has been stable since its first release in 2015.
License in practice
Licensed under Mozilla Public License 2.0 (copyleft), which requires derivative works to disclose modifications and license them under the same terms; suitable for open-source projects but may constrain proprietary use.
Quickstart
import socket
from umodbus.client import tcp
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 502))
message = tcp.write_multiple_coils(slave_id=1, starting_address=1, values=[1, 0, 1, 1])
response = tcp.send_message(message, sock)
sock.close()
Requires a Modbus server listening on the target host and port; RTU mode requires pyserial for serial port communication.
Verify before relying
- Whether the package supports Modbus protocol versions beyond V1.1b3 or extensions like Modbus Plus.
- Current compatibility with Python versions beyond 3.8 (classifiers list only up to 3.8).
- Performance characteristics for high-frequency polling or large register sets.
Package facts
| License | MPL (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyserial |
| Maintenance | actively maintained — 2,178 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 159,886/month — #10,684 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: uModbus-1.0.4-py2.py3-none-any.whl
Tags
More Embedded Systems packages
Provides Python abstractions and utilities for…
copyleft · top 5,000 on PyPI
pyquaternionProvides quaternion representation,…
permissive · top 5,000 on PyPI
crccheckCalculates CRC and checksum values from binary…
permissive · top 5,000 on PyPI
esptoolesptool is a serial utility for flashing,…
copyleft · top 5,000 on PyPI
esp-idf-kconfigProvides kconfig language support and IDE…
permissive · top 5,000 on PyPI
pyocdpyOCD is a Python-based debugger and programmer…
permissive · top 5,000 on PyPI
async-modbusAsync ModBus provides an asynchronous Python…
unclear · top 15,000 on PyPI
pyModbusTCPA pure-Python Modbus/TCP client and server…
permissive · top 15,000 on PyPI
pymodbusPyModbus is a complete Modbus protocol…
permissive · top 5,000 on PyPI
minimalmodbusMinimalmodbus provides a Python interface to…
permissive · top 15,000 on PyPI
nibeNibe provides async communication with Nibe…
copyleft · top 15,000 on PyPI
huawei-solarProvides a Python interface to read and write…
agpl · top 15,000 on PyPI
goodweConnects to GoodWe solar inverters over local…
permissive · top 15,000 on PyPI
pystiebeleltronProvides a Python API to communicate with…
permissive · top 15,000 on PyPI
icmplibicmplib provides a pure Python implementation…
copyleft · top 5,000 on PyPI
pymemcacheA pure-Python memcached client implementing the…
permissive · top 5,000 on PyPI