Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 #658

Closed
wants to merge 50 commits into from
Closed

3.0.0 #658

Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
3ba23f1
Use async/await keywords, reformatting, and pytest use in test_server…
JamesJeffryes Sep 23, 2020
cf86ba6
specify minimum version for attrs and add py3.8 to tox
JamesJeffryes Sep 24, 2020
135ed1f
Drop Test support for Python2
Oct 15, 2020
3d46153
Update xcode version from 8.3 to 12.2
Oct 16, 2020
876ce10
Drop Python2 enviroment
Oct 16, 2020
d484f47
Drop python2 from tox file
Oct 16, 2020
8233d47
Try get virtualenv running with osx
Oct 16, 2020
a0571e1
Try pinning Python version of osx to latest 3.8
Oct 16, 2020
796002e
Add path to get virtuelenv running
Oct 16, 2020
d61659b
Fix check to set IS_HIGH_SIERRA_OR_ABOVE correcrly
Oct 16, 2020
19808e7
Fix Port problem?
Oct 16, 2020
0be43be
Try fix port issue
Oct 16, 2020
3ae6b5a
Fix typo
Oct 16, 2020
510e5cc
Try creating python 3.8 virtualenv since dependecies bumped it up to 3.9
Oct 16, 2020
59facaf
Add Python 3.9 support, because `brew update` update may overwrite wa…
Oct 16, 2020
1a7d44a
Add postfix -dev to run python 3.9 tests
Oct 16, 2020
4477988
Install python 3.9 for mac
Oct 16, 2020
be4432b
Implement asyncio ModbusSeralServer
d21d3q Nov 1, 2020
ee65a90
asyncio: return a coroutine in constructor if called inside the event…
tiagocoutinho Nov 5, 2020
420afe6
Fix logging for serial transport
d21d3q Nov 6, 2020
accb551
Merge pull request #563 from swamper123/Drop_Python2_support_in_travis
dhoomakethu Dec 1, 2020
458b627
Merge branch '3.0.0' into async-keyword
JamesJeffryes Dec 21, 2020
7f9eebe
Merge pull request #534 from JamesJeffryes/async-keyword
dhoomakethu Dec 30, 2020
52f0bef
Update sync.py
Jan 4, 2021
1023e39
Merge pull request #585 from carlosgs91/3.0.0
dhoomakethu Jan 13, 2021
3bdb32d
Be able to create asyncio modbusclients from within a coroutine
Emilv2 Feb 11, 2021
95b4ebd
tests for asyncio modbusclients created in coroutine
Emilv2 Feb 12, 2021
72e3097
Support python3.7 and above, fix sync tests
dhoomakethu Mar 9, 2021
78831b0
Merge branch 'pr-604-coroutine' into 3.0.0
dhoomakethu Mar 9, 2021
efd4833
Add server requiring client's cert in TLS handshake feature
starnight Mar 7, 2021
f222b35
Fix asyncio tests
dhoomakethu Mar 11, 2021
07ba650
Merge branch 'dev' into 3.0.0
dhoomakethu Apr 1, 2021
8b232e5
Revert support to python 2.7 and python 3.6 from github ci
dhoomakethu Apr 1, 2021
731b080
Merge pull request #632 from riptideio/dev
dhoomakethu May 13, 2021
ec3b5ff
-Conditionally import serial modules instead of requiring them to use…
StephenNorCalControls Jun 10, 2021
db1e4a3
Added missing support for broadcast messages on Asyncio client.
NevoSolar Jul 4, 2021
5ba4ff2
add python 3.10 tests
Emilv2 Jul 18, 2021
406683d
sync/ModbusTlsServer: Fix ModbusTlsServer's default framer
starnight Jul 25, 2021
b80992f
Merge branch 'master' into 3.0.0
dhoomakethu Aug 1, 2021
642e256
Merge branch 'dev' into 3.0.0
dhoomakethu Aug 1, 2021
b972a8d
Merge branch 'd21d3q_dev_asyncio_serial_server' into 3.0.0
dhoomakethu Aug 1, 2021
2c13034
Merge branch 'asyncio-create-in-coroutine' into 3.0.0
dhoomakethu Aug 1, 2021
5c71b82
Merge branch 'TLS_handshake_#615' into 3.0.0
dhoomakethu Aug 1, 2021
890d343
Merge branch 'serial_module_lazy_load_#643' into 3.0.0
dhoomakethu Aug 1, 2021
feadd0d
Merge branch 'asyncio_broadcast_support_#650' into 3.0.0
dhoomakethu Aug 1, 2021
d35bc39
Merge branch 'python3.10_tests_#652' into 3.0.0
dhoomakethu Aug 1, 2021
1f4d4d3
Merge branch 'modbus_tls_server_fix_#653' into 3.0.0
dhoomakethu Aug 1, 2021
9e37031
Merging and Closing PR's #556, #558, #604, #615, #643, #650, #652, #653
dhoomakethu Aug 1, 2021
e6674ec
Fix pymodbus TLS module conflicts in 3.0.0 (#661)
starnight Aug 9, 2021
9967ff0
Replace distutils which is deprecated in 3.10 (#668)
alexrudd2 Oct 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
runs-on: ubuntu-latest
matrix: linux
container:
2.7: docker://python:2.7-buster
3.6: docker://python:3.6-buster
3.7: docker://python:3.7-buster
3.8: docker://python:3.8-buster
3.9: docker://python:3.9-buster
Expand All @@ -51,25 +49,6 @@ jobs:
x86: win32
x64: win64
python:
- name: CPython 2.7
tox: py27
action: 2.7
docker: 2.7
matrix: 2.7
implementation: cpython
- name: PyPy 2.7
tox: pypy27
action: pypy-2.7
docker: pypy2.7
matrix: 2.7
implementation: pypy
openssl_msvc_version: 2019
- name: CPython 3.6
tox: py36
action: 3.6
docker: 3.6
matrix: 3.6
implementation: cpython
- name: CPython 3.7
tox: py37
action: 3.7
Expand All @@ -88,13 +67,6 @@ jobs:
docker: 3.9
matrix: 3.9
implementation: cpython
- name: PyPy 3.6
tox: pypy36
action: pypy-3.6
docker: pypy3.6
matrix: 3.6
implementation: pypy
openssl_msvc_version: 2019
- name: PyPy 3.7
tox: pypy37
action: pypy-3.7
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
version 3.0.0dev1
----------------------------------------------------------
* Support python3.10
* Implement asyncio ModbusSerialServer
* ModbusTLS updates (tls handshake, default framer)
* Support broadcast messages with asyncio client
* Fix for lazy loading serial module with asyncio clients.
* Updated examples and tests


version 3.0.0dev0
----------------------------------------------------------
* Support python3.7 and above
* Support creating asyncio clients from with in coroutines.

version 2.5.2
----------------------------------------------------------
* Add kwarg `reset_socket` to control closing of the socket on read failures (set to `True` by default).
Expand Down
9 changes: 6 additions & 3 deletions examples/common/async_asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async def start_async_test(client):
# individual request. This can be done by specifying the `unit` parameter
# which defaults to `0x00`
# ----------------------------------------------------------------------- #
# client = await client
log.debug("Reading Coils")
rr = await client.read_coils(1, 1, unit=0x01)

Expand Down Expand Up @@ -149,7 +150,7 @@ def run_with_not_running_loop():
log.debug("")


def run_with_already_running_loop():
async def run_with_already_running_loop():
"""
An already running loop is passed to ModbusClient Factory
:return:
Expand All @@ -174,9 +175,11 @@ def start_loop(loop):
t.daemon = True
# Start the loop
t.start()
time.sleep(1)
assert loop.is_running()
asyncio.set_event_loop(loop)
loop, client = ModbusClient(schedulers.ASYNC_IO, port=5020, loop=loop)
# client = await client
future = asyncio.run_coroutine_threadsafe(
start_async_test(client.protocol), loop=loop)
future.add_done_callback(done)
Expand Down Expand Up @@ -204,12 +207,12 @@ def run_with_no_loop():
# Run with No loop
log.debug("Running Async client")
log.debug("------------------------------------------------------")
run_with_no_loop()
# run_with_no_loop()

# Run with loop not yet started
# run_with_not_running_loop()

# Run with already running loop
# run_with_already_running_loop()
asyncio.run(run_with_already_running_loop())

log.debug("")
2 changes: 1 addition & 1 deletion examples/common/async_asyncio_serial_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def start_async_test(client):
# ----------------------------------------------------------------------- #
# socat -d -d PTY,link=/tmp/ptyp0,raw,echo=0,ispeed=9600 PTY,
# link=/tmp/ttyp0,raw,echo=0,ospeed=9600
loop, client = ModbusClient(schedulers.ASYNC_IO, port='/tmp/ptyp0',
loop, client = ModbusClient(schedulers.ASYNC_IO, port='/tmp/ttyp0',
baudrate=9600, method="rtu")
loop.run_until_complete(start_async_test(client.protocol))
loop.close()
Expand Down
19 changes: 12 additions & 7 deletions examples/common/asyncio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,13 @@ async def run_server():

# Tls:
# await StartTlsServer(context, identity=identity, address=("localhost", 8020),
# certfile="server.crt", keyfile="server.key",
# certfile="server.crt", keyfile="server.key", password="pwd",
# allow_reuse_address=True, allow_reuse_port=True,
# defer_start=False)

# Tls and force require client's certificate for TLS full handshake:
# await StartTlsServer(context, identity=identity, address=("localhost", 8020),
# certfile="server.crt", keyfile="server.key", password="pwd", reqclicert=True,
# allow_reuse_address=True, allow_reuse_port=True,
# defer_start=False)

Expand All @@ -141,17 +147,16 @@ async def run_server():
# #
# await server.serve_forever()

# !!! SERIAL SERVER NOT IMPLEMENTED !!!
# Ascii:
# StartSerialServer(context, identity=identity,
# port='/dev/ttyp0', timeout=1)
# await StartSerialServer(context, identity=identity,
# port='/dev/ttyp0', timeout=1, autoreconnect=True)

# RTU:
# StartSerialServer(context, framer=ModbusRtuFramer, identity=identity,
# port='/dev/ttyp0', timeout=.005, baudrate=9600)
# await StartSerialServer(context, framer=ModbusRtuFramer, identity=identity,
# port='/dev/ttyp0', timeout=.005, baudrate=9600, autoreconnect=True)

# Binary
# StartSerialServer(context,
# await StartSerialServer(context,
# identity=identity,
# framer=ModbusBinaryFramer,
# port='/dev/ttyp0',
Expand Down
12 changes: 9 additions & 3 deletions examples/common/synchronous_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,21 @@ def run_server():
# run the server you want
# ----------------------------------------------------------------------- #
# Tcp:
StartTcpServer(context, identity=identity, address=("", 5020))
# StartTcpServer(context, identity=identity, address=("", 5020))
#
# TCP with different framer
# StartTcpServer(context, identity=identity,
# framer=ModbusRtuFramer, address=("0.0.0.0", 5020))

# TLS
# StartTlsServer(context, identity=identity, certfile="server.crt",
# keyfile="server.key", address=("0.0.0.0", 8020))
# StartTlsServer(context, identity=identity,
# certfile="server.crt", keyfile="server.key", password="pwd",
# address=("0.0.0.0", 8020))

# Tls and force require client's certificate for TLS full handshake:
# StartTlsServer(context, identity=identity,
# certfile="server.crt", keyfile="server.key", password="pwd", reqclicert=True,
# address=("0.0.0.0", 8020))

# Udp:
# StartUdpServer(context, identity=identity, address=("0.0.0.0", 5020))
Expand Down
21 changes: 12 additions & 9 deletions examples/contrib/asynchronous_asyncio_modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
# -------------------------------------------------------------------------- #
# the TLS detail security can be set in SSLContext which is the context here
# -------------------------------------------------------------------------- #
context = ssl.create_default_context()
context.options |= ssl.OP_NO_SSLv2
context.options |= ssl.OP_NO_SSLv3
context.options |= ssl.OP_NO_TLSv1
context.options |= ssl.OP_NO_TLSv1_1
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
sslctx.verify_mode = ssl.CERT_REQUIRED
sslctx.check_hostname = True

# Prepare client's certificate which the server requires for TLS full handshake
# sslctx.load_cert_chain(certfile="client.crt", keyfile="client.key",
# password="pwd")


async def start_async_test(client):
result = await client.read_coils(1, 8)
Expand All @@ -31,10 +34,10 @@ async def start_async_test(client):
print(result.bits)

if __name__ == '__main__':
# -------------------------------------------------------------------------- #
# pass SSLContext which is the context here to ModbusTcpClient()
# -------------------------------------------------------------------------- #
# ----------------------------------------------------------------------- #
# pass SSLContext which is the context here to ModbusTcpClient()
# ----------------------------------------------------------------------- #
loop, client = AsyncModbusTLSClient(ASYNC_IO, 'test.host.com', 8020,
sslctx=context)
sslctx=sslctx)
loop.run_until_complete(start_async_test(client.protocol))
loop.close()
2 changes: 1 addition & 1 deletion examples/contrib/asynchronous_asyncio_serial_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def make_protocol():

if __name__ == '__main__':
loop = asyncio.get_event_loop()
coro = create_serial_connection(loop, make_protocol, '/dev/ptyp0',
coro = create_serial_connection(loop, make_protocol, '/tmp/ttyp0',
baudrate=9600)
transport, protocol = loop.run_until_complete(asyncio.gather(coro))[0]
loop.run_until_complete(start_async_test(protocol))
Expand Down
14 changes: 8 additions & 6 deletions examples/contrib/modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
# -------------------------------------------------------------------------- #
# the TLS detail security can be set in SSLContext which is the context here
# -------------------------------------------------------------------------- #
context = ssl.create_default_context()
context.options |= ssl.OP_NO_SSLv2
context.options |= ssl.OP_NO_SSLv3
context.options |= ssl.OP_NO_TLSv1
context.options |= ssl.OP_NO_TLSv1_1
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
sslctx.verify_mode = ssl.CERT_REQUIRED
sslctx.check_hostname = True

# Prepare client's certificate which the server requires for TLS full handshake
# sslctx.load_cert_chain(certfile="client.crt", keyfile="client.key",
# password="pwd")

# -------------------------------------------------------------------------- #
# pass SSLContext which is the context here to ModbusTcpClient()
# -------------------------------------------------------------------------- #
client = ModbusTlsClient('test.host.com', 8020, sslctx=context)
client = ModbusTlsClient('test.host.com', 8020, sslctx=sslctx)
client.connect()

result = client.read_coils(1, 8)
Expand Down
Loading