Skip to content

Commit 950a476

Browse files
authored
Clean client directory structure for async. (#1010)
1 parent f0405b2 commit 950a476

38 files changed

+1364
-206
lines changed

README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ PyModbus - A Python Modbus Stack
55
.. image:: https://github.com/riptideio/pymodbus/actions/workflows/ci.yml/badge.svg?branch=dev
66
:target: https://github.com/riptideio/pymodbus/actions/workflows/ci.yml
77
.. image:: https://badges.gitter.im/Join%20Chat.svg
8-
:target: https://gitter.im/pymodbus_dev/Lobby
8+
:target: https://gitter.im/pymodbus_dev/Lobby
99
.. image:: https://readthedocs.org/projects/pymodbus/badge/?version=latest
1010
:target: https://pymodbus.readthedocs.io/en/latest/?badge=latest
1111
:alt: Documentation Status
1212
.. image:: https://pepy.tech/badge/pymodbus
13-
:target: https://pepy.tech/project/pymodbus
13+
:target: https://pepy.tech/project/pymodbus
1414
:alt: Downloads
15-
15+
1616
------------------------------------------------------------
1717
Supported versions
1818
------------------------------------------------------------
@@ -87,7 +87,7 @@ base operating system will allow (*allow* in this case means how many Virtual IP
8787

8888
For more information please browse the project documentation:
8989

90-
https://riptideio.github.io/pymodbus/
90+
https://riptideio.github.io/pymodbus/
9191
or
9292
https://readthedocs.org/docs/pymodbus/en/latest/index.html
9393

@@ -97,8 +97,8 @@ Example Code
9797

9898
For those of you that just want to get started fast, here you go::
9999

100-
from pymodbus.client.sync import ModbusTcpClient
101-
100+
from pymodbus.client import ModbusTcpClient
101+
102102
client = ModbusTcpClient('127.0.0.1')
103103
client.write_coil(1, True)
104104
result = client.read_coils(1,1)
@@ -134,7 +134,7 @@ If you think, that something in the code is broken/not running well, please `ope
134134
------------------------------------------------------------
135135
Pymodbus REPL (Read Evaluate Print Loop)
136136
------------------------------------------------------------
137-
Pymodbus REPL comes with many handy features such as payload decoder
137+
Pymodbus REPL comes with many handy features such as payload decoder
138138
to directly retrieve the values in desired format and supports all
139139
the diagnostic function codes directly .
140140

@@ -158,7 +158,7 @@ This will install a base version of pymodbus.
158158
To install pymodbus with options run:
159159

160160
pip install -U pymodbus[<option>,...]
161-
161+
162162
Available options are:
163163

164164
- **repl**, installs pymodbus REPL.
@@ -181,8 +181,8 @@ Otherwise you can pull the trunk source and install from there::
181181
git clone git://github.com/riptideio/pymodbus.git
182182
cd pymodbus
183183
pip install -r requirements.txt
184-
185-
184+
185+
186186
To get latest release (for now v2.5.3 with Python 2.7 support)::
187187

188188
git checkout master
@@ -193,12 +193,12 @@ To get bleeding edge::
193193

194194
To get a specific version:
195195

196-
git checkout tags/vX.Y.Z -b vX.Y.Z
196+
git checkout tags/vX.Y.Z -b vX.Y.Z
197197

198198
Then::
199199
pip install -r requirements.txt
200200
pip install -e .
201-
201+
202202
This installs pymodbus in your virtual environment with pointers directly to the pymodbus directory, so any change you make is immediately available as if installed.
203203

204204
Either method will install all the required dependencies
@@ -212,7 +212,7 @@ The repository contains a number of important branches and tags.
212212
* **master** is where are releases are kept.
213213
* All releases are tagged with **vX.Y.Z** (e.g. v2.5.3)
214214
* All prereleases are tagged with **vX.Y.ZrcQ** (e.g. v3.0.0.0rc1)
215-
215+
216216
If a maintenance release of an old version is needed (e.g. v2.5.4),
217217
the release tag is used to create a branch with the same name,
218218
and maintenance development is merged here.

doc/source/library/pymodbus.client.asynchronous.rst

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,82 @@
11
pymodbus\.client package
22
========================
33

4-
Pymodbus offers a :mod:`synchronous client <pymodbus.client.sync>`, and async clients based on :mod:`asyncio <pymodbus.client.asynchronous>`.
4+
Pymodbus offers a :mod:`synchronous client <pymodbus.client>`, and async clients based on :mod:`asyncio <pymodbus.client.asynchronous>`.
55

6-
Each client shares a :mod:`common client mixin <pymodbus.client.common>` which offers simple methods for reading and writing.
6+
Each client shares a :mod:`client mixin <pymodbus.client.helper_sync>` which offers simple methods for reading and writing.
77

8-
Subpackages
9-
-----------
8+
Submodules
9+
----------
1010

11-
.. toctree::
11+
pymodbus\.client\.helper_sync module
12+
------------------------------------
1213

13-
pymodbus.client.asynchronous
14+
.. automodule:: pymodbus.client.helper_sync
15+
:members:
16+
:undoc-members:
17+
:show-inheritance:
1418

15-
Submodules
16-
----------
19+
pymodbus\.client\.ModbusSerialClient module
20+
-------------------------------------------
1721

18-
pymodbus\.client\.common module
19-
-------------------------------
22+
.. automodule:: pymodbus.client.sync_serial
23+
:members:
24+
:undoc-members:
25+
:show-inheritance:
2026

21-
.. automodule:: pymodbus.client.common
27+
pymodbus\.client\.ModbusTCPClient module
28+
----------------------------------------
29+
30+
.. automodule:: pymodbus.client.sync_tcp
2231
:members:
2332
:undoc-members:
2433
:show-inheritance:
2534

26-
pymodbus\.client\.sync module
27-
-----------------------------
35+
pymodbus\.client\.ModbusTLSClient module
36+
----------------------------------------
37+
38+
.. automodule:: pymodbus.client.sync_tls
39+
:members:
40+
:undoc-members:
41+
:show-inheritance:
42+
43+
pymodbus\.client\.ModbusUDPClient module
44+
----------------------------------------
45+
46+
.. automodule:: pymodbus.client.sync_udp
47+
:members:
48+
:undoc-members:
49+
:show-inheritance:
50+
51+
pymodbus\.client\.AsyncModbusUDPClient module
52+
---------------------------------------------
53+
54+
.. automodule:: pymodbus.client.async_udp
55+
:members:
56+
:undoc-members:
57+
:show-inheritance:
58+
59+
pymodbus\.client\.AsyncModbusTLSClient module
60+
---------------------------------------------
61+
62+
.. automodule:: pymodbus.client.async_tls
63+
:members:
64+
:undoc-members:
65+
:show-inheritance:
66+
67+
pymodbus\.client\.AsyncModbusSerialClient module
68+
------------------------------------------------
69+
70+
.. automodule:: pymodbus.client.async_serial
71+
:members:
72+
:undoc-members:
73+
:show-inheritance:
74+
75+
76+
pymodbus\.client\.AsyncModbusTCPClient module
77+
---------------------------------------------
2878

29-
.. automodule:: pymodbus.client.sync
79+
.. automodule:: pymodbus.client.async_tcp
3080
:members:
3181
:undoc-members:
3282
:show-inheritance:

examples/client_async.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
# --------------------------------------------------------------------------- #
2929
# import the various client implementations
3030
# --------------------------------------------------------------------------- #
31-
from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient
32-
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient
33-
from pymodbus.client.asynchronous.tls import AsyncModbusTLSClient
34-
from pymodbus.client.asynchronous.udp import AsyncModbusUDPClient
31+
from pymodbus.client import (
32+
AsyncModbusUDPClient,
33+
AsyncModbusTLSClient,
34+
AsyncModbusSerialClient,
35+
AsyncModbusTCPClient,
36+
)
3537
from pymodbus.transaction import (
3638
ModbusAsciiFramer,
3739
ModbusBinaryFramer,

examples/client_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# --------------------------------------------------------------------------- #
2727
# import the various client implementations
2828
# --------------------------------------------------------------------------- #
29-
from pymodbus.client.sync import (
29+
from pymodbus.client import (
3030
ModbusSerialClient,
3131
ModbusTcpClient,
3232
ModbusTlsClient,

examples/common/changing_framers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# --------------------------------------------------------------------------- #
1818
# import the modbus client and the framers
1919
# --------------------------------------------------------------------------- #
20-
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
20+
from pymodbus.client import ModbusTcpClient as ModbusClient
2121
from pymodbus.transaction import ModbusSocketFramer as ModbusFramer
2222

2323
# from pymodbus.transaction import ModbusRtuFramer as ModbusFramer

examples/common/custom_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import struct
1414

1515
from pymodbus.bit_read_message import ReadCoilsRequest
16-
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
16+
from pymodbus.client import ModbusTcpClient as ModbusClient
1717

1818
# --------------------------------------------------------------------------- #
1919
# import the various server implementations

examples/common/payload_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from collections import OrderedDict
1010
import logging
1111

12-
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
12+
from pymodbus.client import ModbusTcpClient as ModbusClient
1313
from pymodbus.constants import Endian
1414
from pymodbus.payload import BinaryPayloadBuilder, BinaryPayloadDecoder
1515

examples/common/performance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from threading import Lock, Thread as tWorker
1616
from time import time
1717

18-
from pymodbus.client.sync import ModbusTcpClient
18+
from pymodbus.client import ModbusTcpClient
1919

2020
try:
2121
from multiprocessing import Process as mWorker, log_to_stderr

examples/contrib/asynchronous_asyncio_modbus_tls_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import ssl
1212
import asyncio
1313

14-
from pymodbus.client.asynchronous.tls import AsyncModbusTLSClient
14+
from pymodbus.client import AsyncModbusTLSClient
1515

1616
# -------------------------------------------------------------------------- #
1717
# the TLS detail security can be set in SSLContext which is the context here

0 commit comments

Comments
 (0)