Skip to content

Commit 779967e

Browse files
committed
Merge branch 'dev'
2 parents 86dae1a + 65fa9ca commit 779967e

File tree

113 files changed

+4948
-5740
lines changed

Some content is hidden

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

113 files changed

+4948
-5740
lines changed

.github/workflows/ci.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
run: |
7474
python -m venv ${{ env.VIRTUAL_ENV }}
7575
python -m pip install --upgrade pip
76-
pip install -e ".[all]"
76+
pip install ".[all]"
7777
7878
- name: codespell
7979
if: matrix.run_doc == true
@@ -101,9 +101,16 @@ jobs:
101101
ruff .
102102
103103
- name: pytest
104+
if: ${{ (matrix.os != 'ubuntu-latest') || (matrix.python != '3.12') }}
104105
run: |
105106
env
106-
pytest -v --cov --full-trace --timeout=1200
107+
pytest
108+
109+
- name: pytest coverage
110+
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python == '3.12') }}
111+
run: |
112+
env
113+
pytest --cov
107114
108115
analyze:
109116
name: Analyze Python

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ __pycache__/
1313
.vscode
1414
.vscode/
1515
build/
16+
prof/
1617
/dist/
1718
/pymodbus.egg-info/
1819
venv
1920
downloaded_files/
20-
htmlcov/

AUTHORS.rst

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Thanks to
2626
- Chris Hung
2727
- Christian Krause
2828
- dhoomakethu
29+
- doelki
2930
- DominicDataP
3031
- Dries
3132
- duc996
@@ -43,9 +44,11 @@ Thanks to
4344
- jan iversen
4445
- Jerome Velociter
4546
- Joe Burmeister
47+
- Jonathan Reichelt Gjertsen
4648
- julian
4749
- Kenny Johansson
4850
- Matthias Straka
51+
- laund
4952
- Logan Gunthorpe
5053
- Marko Luther
5154
- Logan Gunthorpe

CHANGELOG.rst

+60
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,66 @@ 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.6.5
11+
-------------
12+
* Update framers to ease message integration (only decode/encode) (#2064)
13+
* Add negtive acknowledge to modbus exceptions (#2065)
14+
* add Message Socket/TLS and amend tests. (#2061)
15+
* Improve factory types (#2060)
16+
* ASCII. (#2054)
17+
* Improve datastore documentation (#2056)
18+
* Improve types for messages (#2058)
19+
* Improve payload types (#2057)
20+
* Reorganize datastore inheritance (#2055)
21+
* Added new message (framer) raw + 100%coverage. (#2053)
22+
* message classes, first step (#1932)
23+
* Use AbstractMethod in transport. (#2051)
24+
* A datastore for each slave. (#2050)
25+
* Only run coverage in ubuntu / python 3.12 (#2049)
26+
* Replace lambda with functools.partial in transport. (#2047)
27+
* Move self.loop in transport to init() (#2046)
28+
* Fix decoder bug (#2045)
29+
* Add support for server testing in package_test_tool. (#2044)
30+
* DictTransactionManager -> ModbusTransactionManager (#2042)
31+
* eliminate redundant server_close() (#2041)
32+
* Remove reactive server (REPL server). (#2038)
33+
* Improve types for client (#2032)
34+
* Improve HTTP server type hints (#2035)
35+
* eliminate asyncio.sleep() and replace time.sleep() with a timeout (#2034)
36+
* Use "new" inter_byte_timeout and is_open for pyserial (#2031)
37+
* Add more type hints to datastore (#2028)
38+
* Add more framer tests, solve a couple of framer problems. (#2024)
39+
* Rework slow tests (use NULL_MODEM) (#1995)
40+
* Allow slave=0 in serial communication. (#2023)
41+
* Client package test tool. (#2022)
42+
* Add REPL documentation back with links to REPL repo (#2017)
43+
* Move repl to a seperate repo (#2009)
44+
* solve more mypy issues with client (#2013)
45+
* solve more mypy issues with datastore (#2010)
46+
* Remove useless. (#2011)
47+
* streamline transport tests. (#2004)
48+
* Improve types for REPL (#2007)
49+
* Specify more types in base framer (#2005)
50+
* Move htmlcov -> build/cov (#2003)
51+
* Avoid pylint complain about lambda. (#1999)
52+
* Improve client types (#1997)
53+
* Fix setblocking call (#1996)
54+
* Actívate warnings in pytest. (#1994)
55+
* Add profile option to pytest. (#1991)
56+
* Simplify message tests (#1990)
57+
* Upgrade pylint and ruff (#1989)
58+
* Add first architecture document. (#1988)
59+
* Update CONTRIBUTING.rst.
60+
* Return None for broadcast. (#1987)
61+
* Make ModbusClientMixin Generic to fix type issues for sync and async (#1980)
62+
* remove strange None default (#1984)
63+
* Fix incorrect bytearray type hint in diagnostics query (#1983)
64+
* Fix URL to CHANGELOG (#1979)
65+
* move server_hostname to be local in tls client. (#1978)
66+
* Parameter "strict" is and was only used for serial server/client. (#1975)
67+
* Removed unused parameter close_comm_on_error. (#1974)
68+
69+
1070
Version 3.6.4
1171
-------------
1272
* Update datastore_simulator example with client (#1967)

CONTRIBUTING.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Just fork the repo and raise your PR against `dev` branch.
22

33
We always have more work than time, so feel free to open a discussion / issue on a theme you want to solve.
4+
5+
For instructions please refer to README.rst, which details how to install a development environment etc.

MAKE_RELEASE.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Prepare/make release on dev.
1414
* Control / Update API_changes.rst
1515
* Update CHANGELOG.rst
1616
* Add commits from last release, but selectively !
17-
git log --oneline v3.6.1..HEAD > commit.log
17+
git log --oneline v3.6.5..HEAD > commit.log
1818
git log --pretty="%an" v3.6.1..HEAD | sort -uf > authors.log
1919
update AUTHORS
2020
cd doc; ./build_html
@@ -51,3 +51,10 @@ Prepare release on dev for new commits.
5151
------------------------------------------------------------
5252
* Make pull request "prepare dev", with the following:
5353
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)
54+
55+
56+
------------------------------------------------------------
57+
Architecture documentation.
58+
------------------------------------------------------------
59+
* install graphviz
60+
* pyreverse -k -o jpg pymodbus

README.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ PyModbus - A Python Modbus Stack
1111

1212
Pymodbus is a full Modbus protocol implementation offering client/server with synchronous/asynchronous API a well as simulators.
1313

14-
Current release is `3.6.4 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.6.4>`_.
14+
Current release is `3.6.5 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.6.5>`_.
1515

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

18-
All changes are described in `release notes <https://pymodbus.readthedocs.io/en/latest/source/channgelog.html>`_
18+
All changes are described in `release notes <https://pymodbus.readthedocs.io/en/latest/source/changelog.html>`_
1919
and all API changes are `documented <https://pymodbus.readthedocs.io/en/latest/source/api_changes.html>`_
2020

2121
A big thanks to all the `volunteers <https://pymodbus.readthedocs.io/en/latest/source/authors.html>`_ that helps make pymodbus a great project.
@@ -80,7 +80,7 @@ REPL Features
8080
- simulation of broken requests/responses
8181
- simulation of error responses (hard to provoke in real devices)
8282

83-
`REPL documentation <https://https://pymodbus.readthedocs.io/en/dev/source/REPL.html>`_
83+
`REPL documentation <https://github.com/pymodbus-dev/repl>`_
8484

8585

8686
Simulator Features
@@ -274,7 +274,7 @@ There are 2 bigger projects ongoing:
274274
* Add features to and simulator, and enhance the web design
275275

276276

277-
Development Instructions
277+
Development instructions
278278
------------------------
279279
The current code base is compatible with python >= 3.8.
280280

@@ -295,15 +295,18 @@ Make a pull request::
295295

296296
on github open a pull request, check that CI turns green and then wait for review comments.
297297

298-
299298
Test your changes::
300299

301300
cd test
302301
pytest
303302

303+
you can also do extended testing::
304+
305+
pytest --cov <-- Coverage html report in build/html
306+
pytest --profile <-- Call profile report in prof
304307

305-
Architecture
306-
^^^^^^^^^^^^
308+
Internals
309+
^^^^^^^^^
307310

308311
There are no documentation of the architecture (help is welcome), but most classes and
309312
methods are documented:

build/README

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This is the place, where temp files are kept
2+
- html (documention)
3+
- cov (coverage)
4+
- prof (profiling)
5+

check_ci.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ codespell
99
ruff check --fix --exit-non-zero-on-fix .
1010
pylint --recursive=y examples pymodbus test
1111
mypy pymodbus
12-
pytest --numprocesses auto
12+
pytest --cov --numprocesses auto
1313
echo "Ready to push"

doc/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Please select a topic in the left hand column.
1111
source/readme
1212
source/client
1313
source/server
14-
source/REPL
14+
source/repl
1515
source/simulator
1616
source/examples
1717
source/authors

doc/source/_static/examples.tgz

2.07 KB
Binary file not shown.

doc/source/_static/examples.zip

2.29 KB
Binary file not shown.

doc/source/internals.rst

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ Pymodbus internals
1010
library/framer.rst
1111
library/constants.rst
1212
library/pymodbus.rst
13+
14+
library/architecture/architecture.rst
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Architecture
2+
=============
3+
4+
The internal structure of pymodbus is a bit complicated, mostly due to the mixture of sync and async.
5+
6+
The overall architecture can be viewed as:
7+
8+
Client classes (interface to applications)
9+
mixin (interface with all requests defined as methods)
10+
transaction (handles transactions and allow concurrent calls)
11+
framers (add pre/post headers to make a valid package)
12+
transport (handles actual transportation)
13+
14+
Server classes (interface to applications)
15+
datastores (handles registers/values to be returned)
16+
transaction (handles transactions and allow concurrent calls)
17+
framers (add pre/post headers to make a valid package)
18+
transport (handles actual transportation)
19+
20+
In detail the packages can viewed as:
21+
22+
.. image:: packages.png
23+
24+
25+
In detail the classes can be viewed as:
26+
27+
.. image:: classes.png
28+
590 KB
Loading
1.24 MB
Loading

doc/source/REPL.rst renamed to doc/source/repl.rst

+21-62
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
REPL
2-
====
1+
Pymodbus REPL (Read Evaluate Print Loop)
2+
=========================================
3+
4+
.. raw:: html
5+
6+
<p style="color: red;"><strong>Warning:</strong> The Pymodbus REPL documentation is not updated.</p>
37

4-
Dependencies
8+
Installation
59
------------
610

7-
Depends on
8-
`prompt_toolkit <https://python-prompt-toolkit.readthedocs.io/en/stable/index.html>`__
9-
and `click <https://click.palletsprojects.com/>`__
11+
Project repo `pymodbus-repl <https://github.com/pymodbus-dev/repl>`__
1012

11-
Install dependencies
13+
Install as pymodbus optional dependency
14+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1215

1316
::
1417

15-
$ pip install click prompt_toolkit --upgrade
18+
$ pip install ".[repl]"
1619

17-
Or Install pymodbus with repl support
20+
Install directly from the github repo
21+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1822

1923
::
2024

21-
$ pip install pymodbus[repl] --upgrade
25+
$ pip install "git+https://github.com/pymodbus-dev/repl"
2226

2327
Usage Instructions
2428
------------------
@@ -163,7 +167,7 @@ SERIAL
163167
client.get_stopbits Number of stop bits.
164168
client.get_timeout Serial Port Read timeout.
165169
client.idle_time Bus Idle Time to initiate next transaction
166-
client.inter_char_timeout Read Only!
170+
client.inter_byte_timeout Read Only!
167171
client.is_socket_open c l i e n t . i s s o c k e t o p e n
168172
client.mask_write_register Mask content of holding register at `address` with `and_mask` and `or_mask`.
169173
client.method Read Only!
@@ -285,7 +289,7 @@ Client settings could be retrieved and altered as well.
285289
"stopbits": 1.0
286290
}
287291

288-
DEMO
292+
Demo
289293
----
290294

291295
.. |asciicast| image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
@@ -294,70 +298,25 @@ DEMO
294298
:target: https://asciinema.org/a/edUqZN77fdjxL2toisiilJNwI
295299

296300

297-
REPL client classes
298-
-------------------
299-
300-
.. automodule:: pymodbus.repl.client.completer
301-
:members:
302-
:undoc-members:
303-
:show-inheritance:
304-
305-
.. automodule:: pymodbus.repl.client.helper
306-
:members:
307-
:undoc-members:
308-
:show-inheritance:
309-
310-
311-
.. automodule:: pymodbus.repl.client.main
312-
:members:
313-
:undoc-members:
314-
:show-inheritance:
315-
316-
317-
.. automodule:: pymodbus.repl.client.mclient
318-
:members:
319-
:undoc-members:
320-
:show-inheritance:
321-
322-
REPL server classes
323-
-------------------
324-
325-
.. automodule:: pymodbus.repl.server.cli
326-
:members:
327-
:undoc-members:
328-
:show-inheritance:
329-
330-
.. automodule:: pymodbus.repl.server.main
331-
:members:
332-
:undoc-members:
333-
:show-inheritance:
334-
335-
------------------------------------------------------------
336-
Pymodbus REPL (Read Evaluate Print Loop)
337-
------------------------------------------------------------
338-
339-
**Warning** The Pymodbus REPL documentation is not updated.
340-
341-
~~~~~~~~~~~~~~~~~~~~~
342301
Pymodbus REPL Client
343-
~~~~~~~~~~~~~~~~~~~~~
302+
^^^^^^^^^^^^^^^^^^^^
344303

345304
Pymodbus REPL comes with many handy features such as payload decoder
346305
to directly retrieve the values in desired format and supports all
347306
the diagnostic function codes directly .
348307

349-
For more info on REPL Client refer :github:`pymodbus/repl/client/README.rst`
308+
For more info on REPL Client refer `pymodbus repl client <https://github.com/pymodbus-dev/repl/blob/main/pymodbus/repl/client/README.rst>`__
350309

351310
.. image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
352311
:target: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o
353312

354-
~~~~~~~~~~~~~~~~~~~~~
313+
355314
Pymodbus REPL Server
356-
~~~~~~~~~~~~~~~~~~~~~
315+
^^^^^^^^^^^^^^^^^^^^
357316

358317
Pymodbus also comes with a REPL server to quickly run an asynchronous server with additional capabilities out of the box like simulating errors, delay, mangled messages etc.
359318

360-
For more info on REPL Server refer :github:`pymodbus/repl/server/README.rst`
319+
For more info on REPL Server refer `pymodbus repl server <https://github.com/pymodbus-dev/repl/blob/main/pymodbus/repl/server/README.rst>`__
361320

362321
.. image:: https://img.youtube.com/vi/OutaVz0JkWg/maxresdefault.jpg
363322
:target: https://youtu.be/OutaVz0JkWg

0 commit comments

Comments
 (0)