--- id: umodbus version: "1.0.4" license: MPL license_treatment: copyleft maintenance: active --- # uModbus — Implementation of the Modbus protocol in pure Python. License: copyleft · Maintenance: active · Downloads: 159.9K/mo ## 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 above — 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 pip install umodbus uv add umodbus 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: unspecified - Install friction: low - Maintenance: active - Downloads: 159.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags modbus protocol implementation, modbus tcp client server, modbus rtu communication, industrial protocol python, modbus device communication, embedded systems modbus, modbus register read write, modbus-protocol, industrial-automation, embedded-systems [View on SkillFed](https://skillfed.io/packages/umodbus) · [View on PyPI](https://pypi.org/project/umodbus/)