Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Mar 3, 2024
2 parents 86dae1a + 65fa9ca commit 779967e
Show file tree
Hide file tree
Showing 113 changed files with 4,948 additions and 5,740 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: |
python -m venv ${{ env.VIRTUAL_ENV }}
python -m pip install --upgrade pip
pip install -e ".[all]"
pip install ".[all]"
- name: codespell
if: matrix.run_doc == true
Expand Down Expand Up @@ -101,9 +101,16 @@ jobs:
ruff .
- name: pytest
if: ${{ (matrix.os != 'ubuntu-latest') || (matrix.python != '3.12') }}
run: |
env
pytest -v --cov --full-trace --timeout=1200
pytest
- name: pytest coverage
if: ${{ (matrix.os == 'ubuntu-latest') && (matrix.python == '3.12') }}
run: |
env
pytest --cov
analyze:
name: Analyze Python
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ __pycache__/
.vscode
.vscode/
build/
prof/
/dist/
/pymodbus.egg-info/
venv
downloaded_files/
htmlcov/
3 changes: 3 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Thanks to
- Chris Hung
- Christian Krause
- dhoomakethu
- doelki
- DominicDataP
- Dries
- duc996
Expand All @@ -43,9 +44,11 @@ Thanks to
- jan iversen
- Jerome Velociter
- Joe Burmeister
- Jonathan Reichelt Gjertsen
- julian
- Kenny Johansson
- Matthias Straka
- laund
- Logan Gunthorpe
- Marko Luther
- Logan Gunthorpe
Expand Down
60 changes: 60 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,66 @@ helps make pymodbus a better product.

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

Version 3.6.5
-------------
* Update framers to ease message integration (only decode/encode) (#2064)
* Add negtive acknowledge to modbus exceptions (#2065)
* add Message Socket/TLS and amend tests. (#2061)
* Improve factory types (#2060)
* ASCII. (#2054)
* Improve datastore documentation (#2056)
* Improve types for messages (#2058)
* Improve payload types (#2057)
* Reorganize datastore inheritance (#2055)
* Added new message (framer) raw + 100%coverage. (#2053)
* message classes, first step (#1932)
* Use AbstractMethod in transport. (#2051)
* A datastore for each slave. (#2050)
* Only run coverage in ubuntu / python 3.12 (#2049)
* Replace lambda with functools.partial in transport. (#2047)
* Move self.loop in transport to init() (#2046)
* Fix decoder bug (#2045)
* Add support for server testing in package_test_tool. (#2044)
* DictTransactionManager -> ModbusTransactionManager (#2042)
* eliminate redundant server_close() (#2041)
* Remove reactive server (REPL server). (#2038)
* Improve types for client (#2032)
* Improve HTTP server type hints (#2035)
* eliminate asyncio.sleep() and replace time.sleep() with a timeout (#2034)
* Use "new" inter_byte_timeout and is_open for pyserial (#2031)
* Add more type hints to datastore (#2028)
* Add more framer tests, solve a couple of framer problems. (#2024)
* Rework slow tests (use NULL_MODEM) (#1995)
* Allow slave=0 in serial communication. (#2023)
* Client package test tool. (#2022)
* Add REPL documentation back with links to REPL repo (#2017)
* Move repl to a seperate repo (#2009)
* solve more mypy issues with client (#2013)
* solve more mypy issues with datastore (#2010)
* Remove useless. (#2011)
* streamline transport tests. (#2004)
* Improve types for REPL (#2007)
* Specify more types in base framer (#2005)
* Move htmlcov -> build/cov (#2003)
* Avoid pylint complain about lambda. (#1999)
* Improve client types (#1997)
* Fix setblocking call (#1996)
* Actívate warnings in pytest. (#1994)
* Add profile option to pytest. (#1991)
* Simplify message tests (#1990)
* Upgrade pylint and ruff (#1989)
* Add first architecture document. (#1988)
* Update CONTRIBUTING.rst.
* Return None for broadcast. (#1987)
* Make ModbusClientMixin Generic to fix type issues for sync and async (#1980)
* remove strange None default (#1984)
* Fix incorrect bytearray type hint in diagnostics query (#1983)
* Fix URL to CHANGELOG (#1979)
* move server_hostname to be local in tls client. (#1978)
* Parameter "strict" is and was only used for serial server/client. (#1975)
* Removed unused parameter close_comm_on_error. (#1974)


Version 3.6.4
-------------
* Update datastore_simulator example with client (#1967)
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Just fork the repo and raise your PR against `dev` branch.

We always have more work than time, so feel free to open a discussion / issue on a theme you want to solve.

For instructions please refer to README.rst, which details how to install a development environment etc.
9 changes: 8 additions & 1 deletion MAKE_RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Prepare/make release on dev.
* Control / Update API_changes.rst
* Update CHANGELOG.rst
* Add commits from last release, but selectively !
git log --oneline v3.6.1..HEAD > commit.log
git log --oneline v3.6.5..HEAD > commit.log
git log --pretty="%an" v3.6.1..HEAD | sort -uf > authors.log
update AUTHORS
cd doc; ./build_html
Expand Down Expand Up @@ -51,3 +51,10 @@ Prepare release on dev for new commits.
------------------------------------------------------------
* Make pull request "prepare dev", with the following:
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)


------------------------------------------------------------
Architecture documentation.
------------------------------------------------------------
* install graphviz
* pyreverse -k -o jpg pymodbus
17 changes: 10 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ PyModbus - A Python Modbus Stack

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

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

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

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

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

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


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


Development Instructions
Development instructions
------------------------
The current code base is compatible with python >= 3.8.

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

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


Test your changes::

cd test
pytest

you can also do extended testing::

pytest --cov <-- Coverage html report in build/html
pytest --profile <-- Call profile report in prof

Architecture
^^^^^^^^^^^^
Internals
^^^^^^^^^

There are no documentation of the architecture (help is welcome), but most classes and
methods are documented:
Expand Down
5 changes: 5 additions & 0 deletions build/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is the place, where temp files are kept
- html (documention)
- cov (coverage)
- prof (profiling)

2 changes: 1 addition & 1 deletion check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ codespell
ruff check --fix --exit-non-zero-on-fix .
pylint --recursive=y examples pymodbus test
mypy pymodbus
pytest --numprocesses auto
pytest --cov --numprocesses auto
echo "Ready to push"
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Please select a topic in the left hand column.
source/readme
source/client
source/server
source/REPL
source/repl
source/simulator
source/examples
source/authors
Expand Down
Binary file modified doc/source/_static/examples.tgz
Binary file not shown.
Binary file modified doc/source/_static/examples.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions doc/source/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ Pymodbus internals
library/framer.rst
library/constants.rst
library/pymodbus.rst

library/architecture/architecture.rst

28 changes: 28 additions & 0 deletions doc/source/library/architecture/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Architecture
=============

The internal structure of pymodbus is a bit complicated, mostly due to the mixture of sync and async.

The overall architecture can be viewed as:

Client classes (interface to applications)
mixin (interface with all requests defined as methods)
transaction (handles transactions and allow concurrent calls)
framers (add pre/post headers to make a valid package)
transport (handles actual transportation)

Server classes (interface to applications)
datastores (handles registers/values to be returned)
transaction (handles transactions and allow concurrent calls)
framers (add pre/post headers to make a valid package)
transport (handles actual transportation)

In detail the packages can viewed as:

.. image:: packages.png


In detail the classes can be viewed as:

.. image:: classes.png

Binary file added doc/source/library/architecture/classes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/library/architecture/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 21 additions & 62 deletions doc/source/REPL.rst → doc/source/repl.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
REPL
====
Pymodbus REPL (Read Evaluate Print Loop)
=========================================

.. raw:: html

<p style="color: red;"><strong>Warning:</strong> The Pymodbus REPL documentation is not updated.</p>

Dependencies
Installation
------------

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

Install dependencies
Install as pymodbus optional dependency
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

$ pip install click prompt_toolkit --upgrade
$ pip install ".[repl]"

Or Install pymodbus with repl support
Install directly from the github repo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

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

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

DEMO
Demo
----

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


REPL client classes
-------------------

.. automodule:: pymodbus.repl.client.completer
:members:
:undoc-members:
:show-inheritance:

.. automodule:: pymodbus.repl.client.helper
:members:
:undoc-members:
:show-inheritance:


.. automodule:: pymodbus.repl.client.main
:members:
:undoc-members:
:show-inheritance:


.. automodule:: pymodbus.repl.client.mclient
:members:
:undoc-members:
:show-inheritance:

REPL server classes
-------------------

.. automodule:: pymodbus.repl.server.cli
:members:
:undoc-members:
:show-inheritance:

.. automodule:: pymodbus.repl.server.main
:members:
:undoc-members:
:show-inheritance:

------------------------------------------------------------
Pymodbus REPL (Read Evaluate Print Loop)
------------------------------------------------------------

**Warning** The Pymodbus REPL documentation is not updated.

~~~~~~~~~~~~~~~~~~~~~
Pymodbus REPL Client
~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^

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

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

.. image:: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o.png
:target: https://asciinema.org/a/y1xOk7lm59U1bRBE2N1pDIj2o

~~~~~~~~~~~~~~~~~~~~~

Pymodbus REPL Server
~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^

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.

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

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

0 comments on commit 779967e

Please sign in to comment.