Skip to content

Commit

Permalink
Merge branch 'dev' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Jun 4, 2023
2 parents 2b6b40d + 9542a73 commit c54d698
Show file tree
Hide file tree
Showing 48 changed files with 1,665 additions and 816 deletions.
100 changes: 52 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,72 @@ on:


jobs:
linters:
name: Linters
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: venv restore
id: cache-venv
uses: syphar/restore-virtualenv@v1
with:
requirement_files: requirements.txt

- name: venv create
if: steps.cache-venv.outputs.cache-hit != 'true'
run: pip install -e . -r requirements.txt

- name: codespell
run: codespell

- name: pylint
run: pylint --recursive=y examples pymodbus test

- name: precommit (black, bandit, and ruff)
run: pre-commit run --all-files

- name: docs
run: make -C doc/ html

- name: mypy
run: mypy pymodbus


integreation_test:
name: ${{ matrix.task.name }} - ${{ matrix.os.on }} - ${{ matrix.python.version }}
name: pytest - ${{ matrix.os.on }} - ${{ matrix.python.version }}
runs-on: ${{ matrix.os.on }}
needs: linters
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
task:
- name: pylint
cmd: pylint --recursive=y examples pymodbus test
type: lint
- name: codespell
cmd: codespell
type: lint
- name: precommit (black, bandit, and ruff)
cmd: pre-commit run --all-files
type: lint
- name: docs
cmd: make -C doc/ html
type: lint
- name: mypy
cmd: mypy pymodbus
type: lint
- name: pytest
cmd: pytest --cov=pymodbus --cov=test --cov-report=term-missing --cov-report=xml -v --full-trace --timeout=20
type: test
os:
- name: Linux
on: ubuntu-latest
lint: 'yes'
- name: Macos
on: macos-latest
lint: 'no'
- name: Windows
on: windows-latest
lint: 'no'
- on: ubuntu-latest
- on: macos-latest
- on: windows-latest
python:
- version: '3.8'
lint: 'yes'
- version: '3.9'
lint: 'no'
- version: '3.10'
lint: 'no'
- version: '3.11'
lint: 'no'
- version: pypy-3.8
lint: 'no'
exclude:
- task:
type: lint
os:
lint: 'no'
- task:
type: lint
python:
lint: 'no'
- os:
name: Macos
on: macos-latest
python:
version: pypy-3.8
- os:
name: Windows
on: windows-latest
python:
version: pypy-3.8
steps:
Expand All @@ -100,8 +104,8 @@ jobs:
if: steps.cache-venv.outputs.cache-hit != 'true'
run: pip install -e . -r requirements.txt

- name: test/lint
run: ${{ matrix.task.cmd }}
- name: pytest
run: pytest --cov=pymodbus --cov=test --cov-report=term-missing --cov-report=xml -v --full-trace --timeout=20

ci_complete:
name: ci_complete
Expand All @@ -110,5 +114,5 @@ jobs:
- integreation_test
timeout-minutes: 1
steps:
- name: Check out code from GitHub
uses: actions/[email protected]
- name: Dummy
run: ls
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ repos:
- id: black
args: [--safe, --quiet]
files: (examples|pymodbus|test)/
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: [-c, bandit.yaml]
2 changes: 2 additions & 0 deletions API_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ PyModbus - API changes.
-------------
Version 3.3.0
-------------
- ModbusTcpDiagClient is removed due to lack of support
- Clients have an optional parameter: on_reconnect_callback, Function that will be called just before a reconnection attempt.
- general parameter unit= -> slave=
- move SqlSlaveContext, RedisSlaveContext to examples/contrib (due to lack of maintenance)
- :code:`BinaryPayloadBuilder.to_string` was renamed to :code:`BinaryPayloadBuilder.encode`
- on_reconnect_callback for async clients works slightly different
- utilities/unpack_bitstring now expects an argument named `data` not `string`

-------------
Version 3.2.0
Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
version 3.3.0
----------------------------------------------------------
* Stabilize windows tests. (#1567)
* Bump mypy 1.3.0 (#1568)
* Transport integrated in async clients. (#1541)
* Client async corrections (due to 3.1.2) (#1565)
* Server_async[udp], solve 3.1.1 problem. (#1564)
* Remove ModbusTcpDiagClient. (#1560)
* Remove old method from Python2/3 transition (#1559)
* Switch to ruff's version of bandit (#1557)
* Allow reading/writing address 0 in the simulator (#1552)
* Remove references to "defer_start". (#1548)
* Client more robust against faulty response. (#1547)
* Fix missing package_data directives for simulator web (#1544)
* Fix installation instructions (#1543)
* Solve pytest timeout problem. (#1540)
* DiagnosticStatus encode missing tuple check. (#1533)
* test SparseDataStore. (#1532)
* BinaryPayloadBuilder.to_string to BinaryPayloadBuilder.encode (#1526)
* Adding flake8-pytest-style` to ruff (#1520)
* Simplify version management. (#1522)
* pylint and pre-commit autoupdate (#1519)
* Add type hint (#1512)
* Add action to lock issues/PR. (#1508)
* New common transport layer. (#1492)
* Solve serial close raise problem.
* Remove old config values (#1503)
* Document pymodbus.simulator. (#1502)
* Refactor REPL server to reduce complexity (#1499)
* Don't catch KeyboardInterrupt twice for REPL server (#1498)
* Refactor REPL client to reduce complexity (#1489)
* pymodbus.server: listen on ID 1 by default (#1496)
* Clean framer/__init__.py (#1494)
* Duplicate transactions in UDP. (#1486)
* clean ProcessIncommingPacket. (#1491)
* Enable pyupgrade (U) rules in ruff (#1484)
* clean_workflow.yaml solve parameter problem.
* Correct wrong import in test. (#1483)
* Implement pyflakes-simplify (#1480)
* Test case for UDP duplicate msg issue (#1470)
* Test of write_coil. (#1479)
* Test reuse of client object. (#1475)
* Comment about addressing when shared=false (#1474)
* Remove old aliases to OSError (#1473)
* pymodbus.simulator fixes (#1463)
* Fix wrong error message with pymodbus console (#1456)
* update modbusrtuframer (#1435)
* Server multidrop test.: (#1451)
* mypy problem ModbusResponse.

Thanks to:
Alex
Christian Krause
corollaries
dhoomakethu
Ghostkeeper
jan iversen
James Braza
Kenny Johansson
Pavel Kostromitinov

version 3.2.2 (picked from dev, only bugfixes)
----------------------------------------------------------
* Add forgotten await
Expand Down
12 changes: 6 additions & 6 deletions MAKE_RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ Making a release.
------------------------------------------------------------
Prepare/make release on dev.
------------------------------------------------------------
* Make pull request "prepare v3.3.x", with the following:
* Make pull request "prepare v3.4.x", with the following:
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)
* Update README.rst "Supported versions"
* Update CHANGELOG.rst
* Add commits from last release, but selectively !
git log --oneline v3.2.2..HEAD > commit.log
git log v3.2.2..HEAD | grep Author > contributors.log
git log --oneline v3.3.0..HEAD > commit.log
git log v3.3.0..HEAD | grep Author > contributors.log
* Commit, push and merge.
* Checkout master locally
* git merge dev
* git push
* wait for CI to complete on all branches
* On github "prepare release"
* Create tag e.g. v3.0.1dev0
* Title "pymodbus v3.0.1dev0"
* Create tag e.g. v3.4.0dev0
* Title "pymodbus v3.4.0dev0"
* do NOT generate release notes, but copy from CHANGELOG.rst
* make release (remember to mark pre-release if so)
* on local repo
Expand All @@ -40,4 +40,4 @@ Prepare release on dev for new commits.
------------------------------------------------------------
* git branch -D master
* Make pull request "prepare dev", with the following:
* Update pymodbus/version.py with version number (last line)
* Update pymodbus/__init__.py with version number (__version__ X.Y.Zpre)
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ The move from a company organization to pymodbus-dev was done to allow a 100% op
Supported versions
------------------------------------------------------------

Version `2.5.3 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v2.5.3>`_ is the last 2.x release (Supports python 2.7.x - 3.7).
Version `2.5.3 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v2.5.3>`_ is the last 2.x release (Supports python >= 2.7, no longer supported).

Version `3.2.2 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.2.2>`_ is the current release (Supports Python >=3.8).
Version `3.3.0 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.3.0>`_ is the current release (Supports Python >= 3.8).

.. important::
All API changes after 3.0.0 are documented in `API_changes.rst <https://github.com/pymodbus-dev/pymodbus/blob/dev/API_changes.rst>`_
Expand Down Expand Up @@ -245,7 +245,7 @@ Install with Docker
-----------------------------------------------------------
Pull the latest image on ``dev`` branch with ``docker pull ghcr.io/pymodbus-dev/pymodbus:dev``::

doker pull ghcr.io/pymodbus-dev/pymodbus:dev
❯ docker pull ghcr.io/pymodbus-dev/pymodbus:dev
dev: Pulling from pymodbus-dev/pymodbus
548fcab5fe88: Pull complete
a4d3f9f008ef: Pull complete
Expand Down
24 changes: 0 additions & 24 deletions bandit.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions doc/source/library/simulator/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ Example "setup" configuration:
assuming all sizes are set to 10, the addresses for configuration are as follows:
- coils have addresses 0-9,
- discrete_inputs have addresses 10-19,
- holding_registers have addresses 20-29,
- input_registers have addresses 30-39
- input_registers have addresses 20-29,
- holding_registers have addresses 30-39

when configuring the the datatypes (when calling each block start with 0).

Expand Down
23 changes: 21 additions & 2 deletions examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ async def run_async_client(client, modbus_calls=None):
_logger.info("### End of Program")


async def helper():
"""Combine the setup and run"""
args = [
"--comm",
"udp",
"--host",
"127.0.0.1",
"--port",
"5020",
"--framer",
"socket",
"--log",
"debug",
]
testclient = setup_async_client(
description="Run asynchronous client.", cmdline=args
)
await run_async_client(testclient)


if __name__ == "__main__":
testclient = setup_async_client(description="Run asynchronous client.")
asyncio.run(run_async_client(testclient), debug=True)
asyncio.run(helper(), debug=True)
15 changes: 9 additions & 6 deletions examples/client_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ async def _handle_holding_registers(client):
"read_address": 1,
"read_count": 8,
"write_address": 1,
"write_registers": [256, 128, 100, 50, 25, 10, 5, 1],
"values": [256, 128, 100, 50, 25, 10, 5, 1],
}
_check_call(await client.readwrite_registers(slave=SLAVE, **arguments))
rr = _check_call(await client.read_holding_registers(1, 8, slave=SLAVE))
assert rr.registers == arguments["write_registers"]
assert rr.registers == arguments["values"]


async def _handle_input_registers(client):
Expand Down Expand Up @@ -289,11 +289,14 @@ def run_sync_calls(client):
template_call(client)


async def helper():
"""Combine the setup and run"""
testclient = setup_async_client(description="Run asynchronous client.")
await run_async_client(testclient, modbus_calls=run_async_calls)


if __name__ == "__main__":
testclient = setup_async_client(
description="Run modbus calls in asynchronous client."
)
asyncio.run(run_async_client(testclient, modbus_calls=run_async_calls))
asyncio.run(helper())
testclient = setup_sync_client(
description="Run modbus calls in synchronous client."
)
Expand Down
9 changes: 7 additions & 2 deletions examples/client_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ async def run_payload_calls(client):
print("\n")


async def helper():
"""Combine the setup and run"""
testclient = setup_async_client(description="Run asynchronous client.")
await run_async_client(testclient, modbus_calls=run_payload_calls)


if __name__ == "__main__":
testclient = setup_async_client(description="Run payload client.")
asyncio.run(run_async_client(testclient, modbus_calls=run_payload_calls))
asyncio.run(helper())
Loading

0 comments on commit c54d698

Please sign in to comment.