skillfed

uModbus

Implementation of the Modbus protocol in pure Python.

umodbus v1.0.4 159.9K downloads/30d#10,684 on PyPI237
Copyleft license MPL Active released

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 umodbus

uv

uv add umodbus

poetry

poetry add umodbus

Installing 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

Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Operating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Embedded Systems

Tags

modbus protocol implementationmodbus tcp client servermodbus rtu communicationindustrial protocol pythonmodbus device communicationembedded systems modbusmodbus register read write
modbus-protocolindustrial-automationembedded-systems

More Embedded Systems packages