Skip to content

Commit 7c9fa7e

Browse files
committed
Merge branch 'dev'
2 parents 47033c2 + 49ca0ee commit 7c9fa7e

Some content is hidden

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

62 files changed

+805
-646
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- name: Type check with zuban
7878
if: matrix.run_lint == true
7979
run: |
80-
uv run zuban check pymodbus examples
80+
uv run zuban check pymodbus examples test
8181
8282
- name: ruff
8383
if: matrix.run_lint == true

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Thanks to
4848
- Erlend E. Aasland
4949
- Esco441-91
5050
- Farzad Panahi
51+
- Federico
5152
- FedericoMusa
5253
- Fredo70
5354
- Gao Fang

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ 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.12.1
11+
--------------
12+
* SimDevice / SimRuntime fixes. (#2871)
13+
* No inter_frame_time check for baudrate > 38000. (#2882)
14+
* Fix smaller bugs in test, part 2. (#2880)
15+
* simulator startup armoring and update 3.x docs (#2877)
16+
* Fix smaller bugs in test, part 1. (#2879)
17+
* Update README.rst. (#2878)
18+
* Coverage limit is 99.95% (to allow a little margin).
19+
* Removed simulator README, due to unused.
20+
* fix: add warning log when using internal default simulator config (#2874)
21+
* Document simulator entrypoint in README (#2873)
22+
1023
Version 3.12.0
1124
--------------
1225
* Upgrade library versions installed by pip. (#2868)

MAKE_RELEASE.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ 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.12.0..HEAD > commit.log
18-
git log --pretty="%an" v3.12.0..HEAD | sort -uf > authors.log
17+
git log --oneline v3.12.1..HEAD > commit.log
18+
git log --pretty="%an" v3.12.1..HEAD | sort -uf > authors.log
1919
update AUTHORS.rst and CHANGELOG.rst
2020
cd doc; ./build_html
2121
* rm -rf build/* dist/*

README.rst

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ PyModbus - A Python Modbus Stack
1212
:target: https://gurubase.io/g/pymodbus
1313
:alt: PyModbus Guru
1414

15-
Pymodbus is a full Modbus protocol implementation offering a client and server with synchronous/asynchronous API and simulators.
15+
Pymodbus is a full Modbus protocol implementation offering a client, server and simulator with synchronous/asynchronous API.
16+
Please observe that pymodbus follows the standard modbus and have only limited support for non-standard devices.
1617

1718
Our releases follow the pattern `X.Y.Z`. We have strict rules for what different version number updates mean:
1819

@@ -22,9 +23,9 @@ Our releases follow the pattern `X.Y.Z`. We have strict rules for what different
2223

2324
Upgrade examples:
2425

25-
- 3.9.0 -> 3.9.2: just plugin the new version, no changes needed.
26+
- 3.12.0 -> 3.12.2: just plugin the new version, no changes needed.
2627
Remark fixing bugs, can lead to a different behaviors/returns
27-
- 3.8.0 -> 3.9.0: Smaller changes to the pymodbus calls might be needed
28+
- 3.10.0 -> 3.12.0: Smaller changes to the pymodbus calls might be needed (Check `API_changes <https://github.com/pymodbus-dev/pymodbus/blob/dev/API_changes.rst>`_)
2829
- 2.5.4 -> 3.0.0: Major changes in the application might be needed
2930

3031
**REMARK**: As can be seen from the above Pymodbus do NOT follow the semver.org standard.
@@ -35,7 +36,7 @@ as well as the
3536
`API_changes <https://github.com/pymodbus-dev/pymodbus/blob/dev/API_changes.rst>`_
3637
files.
3738

38-
Current release is `3.12.0 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.12.0>`_.
39+
Current release is `3.12.1 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.12.1>`_.
3940

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

@@ -44,7 +45,7 @@ and all API changes are `documented <https://pymodbus.readthedocs.io/en/latest/s
4445

4546
A big thanks to all the `volunteers <https://pymodbus.readthedocs.io/en/latest/source/authors.html>`_ that helps make pymodbus a great project.
4647

47-
Source code on `github <https://github.com/pymodbus-dev/pymodbus>`_
48+
Source code is available on `github <https://github.com/pymodbus-dev/pymodbus>`_
4849

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

@@ -53,9 +54,9 @@ Pymodbus in a nutshell
5354
Pymodbus consist of 5 parts:
5455

5556
- **client**, connect to your favorite device(s)
56-
- **server**, simulate your favorite device(s)
57+
- **server**, create your own device(s)
5758
- **simulator**, an html based server simulator
58-
- **examples**, showing both simple and advances usage
59+
- **examples**, showing both simple and advanced usage
5960

6061
Common features
6162
^^^^^^^^^^^^^^^
@@ -66,7 +67,7 @@ Common features
6667
* Does not have third party dependencies, apart from pyserial (optional)
6768
* Very lightweight project
6869
* Requires Python >= 3.10
69-
* Thorough test suite, that test all corners of the library
70+
* Thorough test suite, that test all corners of the library (100% test coverage)
7071
* Automatically tested on Windows, Linux and MacOS combined with python 3.10 - 3.14
7172
* Strongly typed API (py.typed present)
7273

@@ -78,21 +79,20 @@ Client Features
7879
^^^^^^^^^^^^^^^
7980
* Asynchronous API and synchronous API for applications
8081
* Very simple setup and call sequence (just 6 lines of code)
81-
* Utilities to convert int/float to/from multiple registers
82-
* Encoder/decoder to help with standard python data types
82+
* Utilities to convert python data types to/from multiple registers
8383

8484
`Client documentation <https://pymodbus.readthedocs.io/en/latest/source/client.html>`_
8585

8686

8787
Server Features
8888
^^^^^^^^^^^^^^^
8989
* Asynchronous implementation for high performance
90-
* Synchronous API classes for convenience
91-
* Simulate real life devices
90+
* Synchronous API classes for convenience (runs async internally)
91+
* Emulate real life devices
9292
* Full server control context (device information, counters, etc)
9393
* Different backend datastores to manage register values
9494
* Callback to intercept requests/responses
95-
* Work on RS485 in parallel with other devices
95+
* Work limited on RS485 in parallel with other devices
9696

9797
`Server documentation <https://pymodbus.readthedocs.io/en/latest/source/server.html>`_
9898

@@ -198,7 +198,7 @@ Clone the source, and make a virtual environment::
198198
cd pymodbus
199199
python3 -m venv .venv
200200

201-
Activate the virtual environment, this command needs repeated in every new terminal::
201+
Activate the virtual environment, this command needs to be repeated in every new terminal::
202202

203203
source .venv/bin/activate
204204

@@ -210,9 +210,9 @@ or the bleeding edge::
210210

211211
git checkout dev
212212

213-
Some distributions have an old pip, which needs to be upgraded:
214-
215-
pip install --upgrade pip
213+
.. note::
214+
Please always make your changes in a branch, and never submit a pull request
215+
from dev.
216216

217217
Install required development tools in editable mode::
218218

@@ -223,7 +223,7 @@ Install all (allows creation of documentation etc) in editable mode::
223223
pip install -e ".[all]"
224224

225225
.. note::
226-
The use of the ``-e`` (editable) flag is recommended when working on the ``dev`` branch.
226+
The use of the ``-e`` (editable) flag is recommended when making changes.
227227
It registers the ``pymodbus`` namespace in your virtual environment using pointers to the
228228
source directory. This ensures that any changes you make to the core library are
229229
immediately reflected when running examples or tests.
@@ -263,17 +263,35 @@ need, feel free to submit them so others can benefit.
263263
Also, if you have a question, please `create a post in discussions q&a topic <https://github.com/pymodbus-dev/pymodbus/discussions/new?category=q-a>`_,
264264
so that others can benefit from the results.
265265

266-
- If you think, that something in the code is broken/not running well, please `open an issue <https://github.com/pymodbus-dev/pymodbus/issues/new>`_,
267-
read the Template-text first and then post your issue with your setup information.
266+
If you think, that something in the code is broken/not running well, please `open an issue <https://github.com/pymodbus-dev/pymodbus/issues/new>`_,
267+
read the Template-text first and then post your issue with your setup information.
268268

269269
`Example documentation <https://pymodbus.readthedocs.io/en/dev/source/examples.html>`_
270270

271-
Troubleshooting the dev branch
272-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
271+
Ready to go simulator
272+
^^^^^^^^^^^^^^^^^^^^^
273+
The simulator can be started directly using the installed entry point::
274+
275+
pymodbus.simulator --modbus_device device_try
276+
277+
**Configuration Parameters:**
278+
279+
To ensure the simulator starts with the correct data context, use the following flags:
280+
281+
* ``--json_file``: Path to the configuration JSON (defaults to the internal ``setup.json``).
282+
* ``--modbus_server``: Selects the server type from the JSON ``server_list``.
283+
* ``--modbus_device``: Selects the device registers from the JSON ``device_list``.
284+
* ``--http_port``: Port for the Web UI (default: 8081).
285+
* ``--log``: Sets the log level (default: info).
286+
287+
.. note:: Starting the simulator without explicit parameters may load an internal default configuration.
288+
289+
Troubleshooting examples
290+
^^^^^^^^^^^^^^^^^^^^^^^^
273291
If you encounter errors while running examples, please check:
274292

275293
1. **Namespace Error** (``*** ERROR --> PyModbus not found``):
276-
The package is not registered. Please ensure you followed the installation
294+
The pymodbus package is not registered/installed. Please ensure you followed the installation
277295
steps in the `Install with github`_ section above.
278296

279297
2. **Directory Error** (``*** ERROR --> THIS EXAMPLE needs the example directory...``):
@@ -283,7 +301,8 @@ If you encounter errors while running examples, please check:
283301

284302
Contributing
285303
------------
286-
Just fork the repo and raise your Pull Request against :code:`dev` branch.
304+
Just fork the repo and raise your Pull Request against :code:`dev` branch, but please never
305+
make your changes on the :code:`dev` branch
287306

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

@@ -330,6 +349,11 @@ Test your changes::
330349
cd test
331350
pytest
332351

352+
or
353+
./check_ci.sh
354+
355+
This command also generates the coverage files, which are stored in :code:`build/cov``
356+
333357
you can also do extended testing::
334358

335359
pytest --cov <-- Coverage html report in build/html

check_ci.sh

Lines changed: 1 addition & 1 deletion
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-
zuban check pymodbus examples
11+
zuban check pymodbus examples test
1212
pytest -x --cov --numprocesses auto
1313
echo "Ready to push"

doc/source/_static/examples.tgz

-19 Bytes
Binary file not shown.

doc/source/_static/examples.zip

-5 Bytes
Binary file not shown.

doc/source/library/simulator/config.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ Configuring the pymodbus simulator is done with a json file, or if only
55
using the datastore simulator a python dict (same structure as the
66
device part of the json file).
77

8+
9+
Starting the Simulator
10+
----------------------
11+
12+
The simulator is invoked via the command line entry point. The following parameters allow you to select your configuration and control the server behavior:
13+
14+
* ``--json_file``:
15+
Path to the JSON configuration file.
16+
**Note:** The simulator will validate the existence of this file and fail to start with an error message if it is missing.
17+
* ``--modbus_server``:
18+
Selects which server configuration to load from the ``server_list``.
19+
* ``--modbus_device``:
20+
Selects which device registers to load from the ``device_list``.
21+
* ``--http_host`` / ``--http_port``:
22+
Defines the binding address and port for the Web UI (default port: 8081).
23+
* ``--log``:
24+
Sets the logging level (choices: critical, error, warning, info, debug).
25+
* ``--custom_actions_module``:
26+
Optional Python file for custom register behaviors.
27+
28+
829
Json file layout
930
----------------
1031

doc/source/simulator/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Usage examples
2323

2424
Class definitions
2525
^^^^^^^^^^^^^^^^^
26-
.. autoclass:: pymodbus.constants.DataType
26+
.. autoclass:: pymodbus.simulator.DataType
2727
:members:
2828
:undoc-members:
2929
:member-order: bysource

0 commit comments

Comments
 (0)