Skip to content

Commit efb02eb

Browse files
committed
Merge branch 'dev'
2 parents a1c14c7 + fb6443f commit efb02eb

File tree

119 files changed

+4163
-5986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+4163
-5986
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
fail-fast: false
3737
matrix:
3838
os: [ubuntu-latest, macos-latest, windows-latest]
39-
python: ['3.9', '3.10', '3.11', '3.12', "3.13"]
39+
python: ['3.9', '3.10', '3.11', '3.12', "3.13.0"]
4040
include:
4141
- python: '3.9'
4242
run_lint: true
43-
- python: '3.13'
43+
- python: '3.13.0'
4444
run_doc: true
4545
run_lint: true
4646
- os: macos-latest
@@ -105,7 +105,7 @@ jobs:
105105
- name: mypy
106106
if: matrix.run_lint == true
107107
run: |
108-
mypy pymodbus
108+
mypy pymodbus examples
109109
110110
- name: ruff
111111
if: matrix.run_lint == true

API_changes.rst

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ API changes
22
===========
33
Versions (X.Y.Z) where Z > 0 e.g. 3.0.1 do NOT have API changes!
44

5+
API changes 3.8.0
6+
-----------------
7+
- ModbusSlaveContext, removed zero_mode parameter.
8+
- Removed skip_encode parameter.
9+
- renamed ModbusExceptions enums to legal constants.
10+
- enforced client keyword only parameters (positional not allowed).
11+
- added trace_packet/pdu/connect to client/server.
12+
- removed on_connect_callback from client.
13+
- removed response_manipulator, request_tracer from server.
514

615
API changes 3.7.0
716
-----------------

AUTHORS.rst

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Thanks to
2929
- Chandler Riehm
3030
- Chris Hung
3131
- Christian Krause
32+
- Christian Pfisterer
3233
- Daniel Rauber
3334
- dhoomakethu
3435
- doelki
@@ -56,6 +57,7 @@ Thanks to
5657
- Joe Burmeister
5758
- John Miko
5859
- Jonathan Reichelt Gjertsen
60+
- JorisW
5961
- julian
6062
- Justin Standring
6163
- Kenny Johansson

CHANGELOG.rst

+48
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,54 @@ helps make pymodbus a better product.
77

88
:ref:`Authors`: contains a complete list of volunteers have contributed to each major version.
99

10+
Version 3.8.0
11+
-------------
12+
* slave_id -> dev_id (internally). (#2486)
13+
* Pin python 3.13.0 and update ruff. (#2487)
14+
* Add documentation link to README. (#2483)
15+
* Add datatype bits to convert_to/from_registers. (#2480)
16+
* Add trace API to server. (#2479)
17+
* Add trace API for client. (#2478)
18+
* Integrate TransactionManager in server. (#2475)
19+
* Rename test/sub_. (#2473)
20+
* Check server closes file descriptors. (#2472)
21+
* Update http_server.py (#2471)
22+
* Restrict write_registers etc to list[int]. (#2469)
23+
* Write_registers/pdu typing again. (#2468)
24+
* Remove ModbusExceptions enum. (#2467)
25+
* Add special ssl socket handling of "no data". (#2466)
26+
* Add tip that values= will be modified to list[int]. (#2465)
27+
* client 100% test coverage (#2396)
28+
* Extend TransactionManager to handle sync. (#2457)
29+
* Add convert_from to simple examples. (#2458)
30+
* New async transaction manager. (#2453)
31+
* Deprecate BinaryPayloadDecoder / BinaryPayloadBuilder. (#2456)
32+
* Correct close for server transport. (#2455)
33+
* RTU frame problem, when received split. (#2452)
34+
* pdu, 100% coverage. (#2450)
35+
* Refactor PDU, add strong typing to base classes. (#2438)
36+
* Enforce keyword only parameters. (#2448)
37+
* Fix read_device_information with sync client. (#2441)
38+
* Simplify syncTransactionManager. (#2443)
39+
* Import examples direct. (#2442)
40+
* rename ModbusExceptions enums to legal constants. (#2436)
41+
* Add typing to examples. (#2435)
42+
* Refactor PDU diag. (#2421)
43+
* Fix client lock, Parallel API calls are not permitted. (#2434)
44+
* Ensure accept_no_response_limit > retries. (#2433)
45+
* Check client and frametype. (#2426)
46+
* Add MDAP to TLS frame. (#2425)
47+
* Clean/Finalize testing for bit functions. (#2420)
48+
* Simplify pdu bit, remove skip_encode. (#2417)
49+
* remove zero_mode parameter. (#2354)
50+
* Prepare refactor messages. (#2416)
51+
* Fixed handle local echo in serialserver (#2415)
52+
* Correct minor framer/pdu errors. (#2407)
53+
* Rtu decode frames without byte count. (#2412)
54+
* Improve type of parameter values of write_registers (#2411)
55+
* PDU lookupClass work with sub function code. (#2410)
56+
* Correct wait_next_api link in README. (#2406)
57+
1058
Version 3.7.4
1159
-------------
1260
* Clean PDU init. (#2399)

MAKE_RELEASE.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ Prepare/make release on dev.
1111
* Make pull request "prepare v3.7.x", with the following:
1212
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)
1313
* Update README.rst "Supported versions"
14+
* Update roadmap.rst
1415
* Control / Update API_changes.rst
1516
* Update CHANGELOG.rst
1617
* Add commits from last release, but selectively !
17-
git log --oneline v3.7.4..HEAD > commit.log
18-
git log --pretty="%an" v3.7.4..HEAD | sort -uf > authors.log
18+
git log --oneline v3.8.0..HEAD > commit.log
19+
git log --pretty="%an" v3.8.0..HEAD | sort -uf > authors.log
1920
update AUTHORS.rst and CHANGELOG.rst
20-
update roadmap.rst
2121
cd doc; ./build_html
2222
* rm -rf build/* dist/*
2323
* python3 -m build

README.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ Upgrade examples:
2626
- 3.6.1 -> 3.7.0: Smaller changes to the pymodbus calls might be needed
2727
- 2.5.4 -> 3.0.0: Major changes in the application might be needed
2828

29-
Current release is `3.7.4 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.7.4>`_.
29+
Current release is `3.8.0 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.8.0>`_.
3030

3131
Bleeding edge (not released) is `dev <https://github.com/pymodbus-dev/pymodbus/tree/dev>`_.
3232

33-
Waiting for v3.8.0 (not released) is `wait_next_API <https://github.com/pymodbus-dev/pymodbus/tree/wait_next_API>`_. This contains
33+
Waiting for v3.9.0 (not released) is `wait_next_api <https://github.com/pymodbus-dev/pymodbus/tree/wait_next_api>`_. This contains
3434
dev + merged pull requests that have API changes, and thus have to wait.
3535

3636
All changes are described in `release notes <https://pymodbus.readthedocs.io/en/latest/source/changelog.html>`_
@@ -40,6 +40,9 @@ A big thanks to all the `volunteers <https://pymodbus.readthedocs.io/en/latest/s
4040

4141
Source code on `github <https://github.com/pymodbus-dev/pymodbus>`_
4242

43+
Full documentation for newest releases as well as the bleeding edge (dev) `readthedocs <https://pymodbus.readthedocs.io>`_
44+
45+
4346
Pymodbus in a nutshell
4447
----------------------
4548
Pymodbus consist of 5 parts:

check_ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
88
codespell
99
ruff check --fix --exit-non-zero-on-fix .
1010
pylint --recursive=y examples pymodbus test
11-
mypy pymodbus
11+
mypy pymodbus examples
1212
pytest -x --cov --numprocesses auto
1313
echo "Ready to push"

doc/source/_static/examples.tgz

595 KB
Binary file not shown.

doc/source/_static/examples.zip

1.2 KB
Binary file not shown.

doc/source/examples.rst

+1-19
Original file line numberDiff line numberDiff line change
@@ -210,28 +210,10 @@ Source: :github:`examples/contrib/solar.py`
210210
:noindex:
211211

212212

213-
Redis datastore
214-
^^^^^^^^^^^^^^^
215-
Source: :github:`examples/contrib/redis_datastore.py`
216-
217-
.. automodule:: examples.contrib.redis_datastore
218-
:undoc-members:
219-
:noindex:
220-
221-
222213
Serial Forwarder
223214
^^^^^^^^^^^^^^^^
224215
Source: :github:`examples/contrib/serial_forwarder.py`
225216

226217
.. automodule:: examples.contrib.serial_forwarder
227218
:undoc-members:
228-
:noindex:
229-
230-
231-
Sqlalchemy datastore
232-
^^^^^^^^^^^^^^^^^^^^
233-
Source: :github:`examples/contrib/sql_datastore.py`
234-
235-
.. automodule:: examples.contrib.sql_datastore
236-
:undoc-members:
237-
:noindex:
219+
:noindex:

doc/source/library/pymodbus.rst

+2-12
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ PDU classes
4545
:undoc-members:
4646
:show-inheritance:
4747

48-
.. automodule:: pymodbus.pdu.bit_read_message
49-
:members:
50-
:undoc-members:
51-
:show-inheritance:
52-
53-
.. automodule:: pymodbus.pdu.bit_write_message
48+
.. automodule:: pymodbus.pdu.bit_message
5449
:members:
5550
:undoc-members:
5651
:show-inheritance:
@@ -81,12 +76,7 @@ PDU classes
8176
:show-inheritance:
8277
:noindex:
8378

84-
.. automodule:: pymodbus.pdu.register_read_message
85-
:members:
86-
:undoc-members:
87-
:show-inheritance:
88-
89-
.. automodule:: pymodbus.pdu.register_write_message
79+
.. automodule:: pymodbus.pdu.register_message
9080
:members:
9181
:undoc-members:
9282
:show-inheritance:

doc/source/library/simulator/calls_response.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -116,47 +116,47 @@
116116
"function_error": [
117117
{
118118
"value": 1,
119-
"text": "IllegalFunction",
119+
"text": "ILLEGAL_FUNCTION",
120120
"selected": false
121121
},
122122
{
123123
"value": 2,
124-
"text": "IllegalAddress",
124+
"text": "ILLEGAL_ADDRESS",
125125
"selected": false
126126
},
127127
{
128128
"value": 3,
129-
"text": "IllegalValue",
129+
"text": "ILLEGAL_VALUE",
130130
"selected": false
131131
},
132132
{
133133
"value": 4,
134-
"text": "SlaveFailure",
134+
"text": "SLAVE_FAILURE",
135135
"selected": false
136136
},
137137
{
138138
"value": 5,
139-
"text": "Acknowledge",
139+
"text": "ACKNOWLEDGE",
140140
"selected": false
141141
},
142142
{
143143
"value": 6,
144-
"text": "SlaveBusy",
144+
"text": "SLAVE_BUSY",
145145
"selected": false
146146
},
147147
{
148148
"value": 7,
149-
"text": "MemoryParityError",
149+
"text": "MEMORY_PARITY_ERROR",
150150
"selected": false
151151
},
152152
{
153153
"value": 10,
154-
"text": "GatewayPathUnavailable",
154+
"text": "GATEWAY_PATH_UNAVIABLE",
155155
"selected": false
156156
},
157157
{
158158
"value": 11,
159-
"text": "GatewayNoResponse",
159+
"text": "GATEWAY_NO_RESPONSE",
160160
"selected": false
161161
}
162162
],

doc/source/roadmap.rst

+8-10
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ It is the community that decides how pymodbus evolves NOT the maintainers !
1515

1616
The following bullet points are what the maintainers focus on:
1717

18-
- 3.7.5, bug fix release, hopefully with:
19-
- Simplify PDU classes
20-
- Simplify transaction manager (central control point)
21-
- Remove ModbusControlBlock
22-
- 3.7.6, bug fix release, with:
23-
- Not planned
24-
- 3.8.0, with:
25-
- new transaction handling
26-
- transaction 100% coverage
27-
- skip_encode, zero_mode parameters removed
18+
- 3.8.1, bug fix release, with:
19+
- Currently not planned
20+
- 3.9.0, with:
21+
- ModbusControlBlock pr slave
22+
- New custom PDU (function codes)
23+
- Remove remote_datastore
24+
- Remove BinaryPayload
2825
- 4.0.0, with:
26+
- New serial forwarder
2927
- client async with sync/async API
3028
- Only one datastore, but with different API`s
3129
- Simulator standard in server

examples/client_async.py

+10-13
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,35 @@
2626
The corresponding server must be started before e.g. as:
2727
python3 server_sync.py
2828
"""
29+
from __future__ import annotations
30+
2931
import asyncio
3032
import logging
3133
import sys
3234

3335

3436
try:
35-
import helper
37+
import helper # type: ignore[import-not-found]
3638
except ImportError:
3739
print("*** ERROR --> THIS EXAMPLE needs the example directory, please see \n\
3840
https://pymodbus.readthedocs.io/en/latest/source/examples.html\n\
3941
for more information.")
4042
sys.exit(-1)
4143

4244
import pymodbus.client as modbusClient
43-
from pymodbus import ModbusException
4445

4546

4647
_logger = logging.getLogger(__file__)
4748
_logger.setLevel("DEBUG")
4849

4950

50-
def setup_async_client(description=None, cmdline=None):
51+
def setup_async_client(description: str | None =None, cmdline: str | None = None) -> modbusClient.ModbusBaseClient:
5152
"""Run client setup."""
5253
args = helper.get_commandline(
5354
server=False, description=description, cmdline=cmdline
5455
)
5556
_logger.info("### Create client object")
56-
client = None
57+
client: modbusClient.ModbusBaseClient | None = None
5758
if args.comm == "tcp":
5859
client = modbusClient.AsyncModbusTcpClient(
5960
args.host,
@@ -124,15 +125,11 @@ async def run_async_client(client, modbus_calls=None):
124125

125126
async def run_a_few_calls(client):
126127
"""Test connection works."""
127-
try:
128-
rr = await client.read_coils(32, 1, slave=1)
129-
assert len(rr.bits) == 8
130-
rr = await client.read_holding_registers(4, 2, slave=1)
131-
assert rr.registers[0] == 17
132-
assert rr.registers[1] == 17
133-
except ModbusException:
134-
pass
135-
128+
rr = await client.read_coils(32, count=1, slave=1)
129+
assert len(rr.bits) == 8
130+
rr = await client.read_holding_registers(4, count=2, slave=1)
131+
assert rr.registers[0] == 17
132+
assert rr.registers[1] == 17
136133

137134
async def main(cmdline=None):
138135
"""Combine setup and run."""

0 commit comments

Comments
 (0)