Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Dec 7, 2024
2 parents a1c14c7 + fb6443f commit efb02eb
Show file tree
Hide file tree
Showing 119 changed files with 4,163 additions and 5,986 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.9', '3.10', '3.11', '3.12', "3.13"]
python: ['3.9', '3.10', '3.11', '3.12', "3.13.0"]
include:
- python: '3.9'
run_lint: true
- python: '3.13'
- python: '3.13.0'
run_doc: true
run_lint: true
- os: macos-latest
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
- name: mypy
if: matrix.run_lint == true
run: |
mypy pymodbus
mypy pymodbus examples
- name: ruff
if: matrix.run_lint == true
Expand Down
9 changes: 9 additions & 0 deletions API_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ API changes
===========
Versions (X.Y.Z) where Z > 0 e.g. 3.0.1 do NOT have API changes!

API changes 3.8.0
-----------------
- ModbusSlaveContext, removed zero_mode parameter.
- Removed skip_encode parameter.
- renamed ModbusExceptions enums to legal constants.
- enforced client keyword only parameters (positional not allowed).
- added trace_packet/pdu/connect to client/server.
- removed on_connect_callback from client.
- removed response_manipulator, request_tracer from server.

API changes 3.7.0
-----------------
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Thanks to
- Chandler Riehm
- Chris Hung
- Christian Krause
- Christian Pfisterer
- Daniel Rauber
- dhoomakethu
- doelki
Expand Down Expand Up @@ -56,6 +57,7 @@ Thanks to
- Joe Burmeister
- John Miko
- Jonathan Reichelt Gjertsen
- JorisW
- julian
- Justin Standring
- Kenny Johansson
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,54 @@ helps make pymodbus a better product.

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

Version 3.8.0
-------------
* slave_id -> dev_id (internally). (#2486)
* Pin python 3.13.0 and update ruff. (#2487)
* Add documentation link to README. (#2483)
* Add datatype bits to convert_to/from_registers. (#2480)
* Add trace API to server. (#2479)
* Add trace API for client. (#2478)
* Integrate TransactionManager in server. (#2475)
* Rename test/sub_. (#2473)
* Check server closes file descriptors. (#2472)
* Update http_server.py (#2471)
* Restrict write_registers etc to list[int]. (#2469)
* Write_registers/pdu typing again. (#2468)
* Remove ModbusExceptions enum. (#2467)
* Add special ssl socket handling of "no data". (#2466)
* Add tip that values= will be modified to list[int]. (#2465)
* client 100% test coverage (#2396)
* Extend TransactionManager to handle sync. (#2457)
* Add convert_from to simple examples. (#2458)
* New async transaction manager. (#2453)
* Deprecate BinaryPayloadDecoder / BinaryPayloadBuilder. (#2456)
* Correct close for server transport. (#2455)
* RTU frame problem, when received split. (#2452)
* pdu, 100% coverage. (#2450)
* Refactor PDU, add strong typing to base classes. (#2438)
* Enforce keyword only parameters. (#2448)
* Fix read_device_information with sync client. (#2441)
* Simplify syncTransactionManager. (#2443)
* Import examples direct. (#2442)
* rename ModbusExceptions enums to legal constants. (#2436)
* Add typing to examples. (#2435)
* Refactor PDU diag. (#2421)
* Fix client lock, Parallel API calls are not permitted. (#2434)
* Ensure accept_no_response_limit > retries. (#2433)
* Check client and frametype. (#2426)
* Add MDAP to TLS frame. (#2425)
* Clean/Finalize testing for bit functions. (#2420)
* Simplify pdu bit, remove skip_encode. (#2417)
* remove zero_mode parameter. (#2354)
* Prepare refactor messages. (#2416)
* Fixed handle local echo in serialserver (#2415)
* Correct minor framer/pdu errors. (#2407)
* Rtu decode frames without byte count. (#2412)
* Improve type of parameter values of write_registers (#2411)
* PDU lookupClass work with sub function code. (#2410)
* Correct wait_next_api link in README. (#2406)

Version 3.7.4
-------------
* Clean PDU init. (#2399)
Expand Down
6 changes: 3 additions & 3 deletions MAKE_RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Prepare/make release on dev.
* Make pull request "prepare v3.7.x", with the following:
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)
* Update README.rst "Supported versions"
* Update roadmap.rst
* Control / Update API_changes.rst
* Update CHANGELOG.rst
* Add commits from last release, but selectively !
git log --oneline v3.7.4..HEAD > commit.log
git log --pretty="%an" v3.7.4..HEAD | sort -uf > authors.log
git log --oneline v3.8.0..HEAD > commit.log
git log --pretty="%an" v3.8.0..HEAD | sort -uf > authors.log
update AUTHORS.rst and CHANGELOG.rst
update roadmap.rst
cd doc; ./build_html
* rm -rf build/* dist/*
* python3 -m build
Expand Down
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Upgrade examples:
- 3.6.1 -> 3.7.0: Smaller changes to the pymodbus calls might be needed
- 2.5.4 -> 3.0.0: Major changes in the application might be needed

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

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

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

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

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

Full documentation for newest releases as well as the bleeding edge (dev) `readthedocs <https://pymodbus.readthedocs.io>`_


Pymodbus in a nutshell
----------------------
Pymodbus consist of 5 parts:
Expand Down
2 changes: 1 addition & 1 deletion check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
codespell
ruff check --fix --exit-non-zero-on-fix .
pylint --recursive=y examples pymodbus test
mypy pymodbus
mypy pymodbus examples
pytest -x --cov --numprocesses auto
echo "Ready to push"
Binary file modified doc/source/_static/examples.tgz
Binary file not shown.
Binary file modified doc/source/_static/examples.zip
Binary file not shown.
20 changes: 1 addition & 19 deletions doc/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,28 +210,10 @@ Source: :github:`examples/contrib/solar.py`
:noindex:


Redis datastore
^^^^^^^^^^^^^^^
Source: :github:`examples/contrib/redis_datastore.py`

.. automodule:: examples.contrib.redis_datastore
:undoc-members:
:noindex:


Serial Forwarder
^^^^^^^^^^^^^^^^
Source: :github:`examples/contrib/serial_forwarder.py`

.. automodule:: examples.contrib.serial_forwarder
:undoc-members:
:noindex:


Sqlalchemy datastore
^^^^^^^^^^^^^^^^^^^^
Source: :github:`examples/contrib/sql_datastore.py`

.. automodule:: examples.contrib.sql_datastore
:undoc-members:
:noindex:
:noindex:
14 changes: 2 additions & 12 deletions doc/source/library/pymodbus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ PDU classes
:undoc-members:
:show-inheritance:

.. automodule:: pymodbus.pdu.bit_read_message
:members:
:undoc-members:
:show-inheritance:

.. automodule:: pymodbus.pdu.bit_write_message
.. automodule:: pymodbus.pdu.bit_message
:members:
:undoc-members:
:show-inheritance:
Expand Down Expand Up @@ -81,12 +76,7 @@ PDU classes
:show-inheritance:
:noindex:

.. automodule:: pymodbus.pdu.register_read_message
:members:
:undoc-members:
:show-inheritance:

.. automodule:: pymodbus.pdu.register_write_message
.. automodule:: pymodbus.pdu.register_message
:members:
:undoc-members:
:show-inheritance:
18 changes: 9 additions & 9 deletions doc/source/library/simulator/calls_response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,47 +116,47 @@
"function_error": [
{
"value": 1,
"text": "IllegalFunction",
"text": "ILLEGAL_FUNCTION",
"selected": false
},
{
"value": 2,
"text": "IllegalAddress",
"text": "ILLEGAL_ADDRESS",
"selected": false
},
{
"value": 3,
"text": "IllegalValue",
"text": "ILLEGAL_VALUE",
"selected": false
},
{
"value": 4,
"text": "SlaveFailure",
"text": "SLAVE_FAILURE",
"selected": false
},
{
"value": 5,
"text": "Acknowledge",
"text": "ACKNOWLEDGE",
"selected": false
},
{
"value": 6,
"text": "SlaveBusy",
"text": "SLAVE_BUSY",
"selected": false
},
{
"value": 7,
"text": "MemoryParityError",
"text": "MEMORY_PARITY_ERROR",
"selected": false
},
{
"value": 10,
"text": "GatewayPathUnavailable",
"text": "GATEWAY_PATH_UNAVIABLE",
"selected": false
},
{
"value": 11,
"text": "GatewayNoResponse",
"text": "GATEWAY_NO_RESPONSE",
"selected": false
}
],
Expand Down
18 changes: 8 additions & 10 deletions doc/source/roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ It is the community that decides how pymodbus evolves NOT the maintainers !

The following bullet points are what the maintainers focus on:

- 3.7.5, bug fix release, hopefully with:
- Simplify PDU classes
- Simplify transaction manager (central control point)
- Remove ModbusControlBlock
- 3.7.6, bug fix release, with:
- Not planned
- 3.8.0, with:
- new transaction handling
- transaction 100% coverage
- skip_encode, zero_mode parameters removed
- 3.8.1, bug fix release, with:
- Currently not planned
- 3.9.0, with:
- ModbusControlBlock pr slave
- New custom PDU (function codes)
- Remove remote_datastore
- Remove BinaryPayload
- 4.0.0, with:
- New serial forwarder
- client async with sync/async API
- Only one datastore, but with different API`s
- Simulator standard in server
Expand Down
23 changes: 10 additions & 13 deletions examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,35 @@
The corresponding server must be started before e.g. as:
python3 server_sync.py
"""
from __future__ import annotations

import asyncio
import logging
import sys


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

import pymodbus.client as modbusClient
from pymodbus import ModbusException


_logger = logging.getLogger(__file__)
_logger.setLevel("DEBUG")


def setup_async_client(description=None, cmdline=None):
def setup_async_client(description: str | None =None, cmdline: str | None = None) -> modbusClient.ModbusBaseClient:
"""Run client setup."""
args = helper.get_commandline(
server=False, description=description, cmdline=cmdline
)
_logger.info("### Create client object")
client = None
client: modbusClient.ModbusBaseClient | None = None
if args.comm == "tcp":
client = modbusClient.AsyncModbusTcpClient(
args.host,
Expand Down Expand Up @@ -124,15 +125,11 @@ async def run_async_client(client, modbus_calls=None):

async def run_a_few_calls(client):
"""Test connection works."""
try:
rr = await client.read_coils(32, 1, slave=1)
assert len(rr.bits) == 8
rr = await client.read_holding_registers(4, 2, slave=1)
assert rr.registers[0] == 17
assert rr.registers[1] == 17
except ModbusException:
pass

rr = await client.read_coils(32, count=1, slave=1)
assert len(rr.bits) == 8
rr = await client.read_holding_registers(4, count=2, slave=1)
assert rr.registers[0] == 17
assert rr.registers[1] == 17

async def main(cmdline=None):
"""Combine setup and run."""
Expand Down
Loading

0 comments on commit efb02eb

Please sign in to comment.