Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel
twine upload dist/*
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
3.7: docker://python:3.7-buster
3.8: docker://python:3.8-buster
3.9: docker://python:3.9-buster
pypy2: docker://pypy:2-jessie
pypy3: docker://pypy:3-stretch
- name: macOS
runs-on: macos-latest
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ version 3.0.0dev1
* Fix for lazy loading serial module with asyncio clients.
* Updated examples and tests


version 3.0.0dev0
----------------------------------------------------------
* Support python3.7 and above
Expand Down
22 changes: 6 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,12 @@ check: install

test: install
@pip install --upgrade --quiet --requirement=requirements-tests.txt
ifeq ($(PYVER),3.6)
$(info Running tests on $(PYVER))
@pip install --upgrade pip --quiet
@pytest --cov=pymodbus/ --cov-report term-missing test/test_server_asyncio.py test
@coverage report --fail-under=85 -i
else ifeq ($(PYVER),2.7)
$(info Running tests on $(PYVER))
@pip install pip==20.3.4 --quiet
@pytest --cov-config=.coveragerc --cov=pymodbus/ --cov-report term-missing --ignore test/test_server_asyncio.py --ignore test/test_client_async_asyncio.py test
@coverage report --fail-under=90 -i
else
$(info Running tests on $(PYVER))
@pip install --upgrade pip --quiet
@pytest --cov=pymodbus/ --cov-report term-missing test
@coverage report --fail-under=85 -i
endif

$(info Running tests on $(PYVER))
@pip install --upgrade pip --quiet
@pytest --cov=pymodbus/ --cov-report term-missing test
@coverage report --fail-under=85 -i


tox: install
@pip install --upgrade --quiet tox && tox
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Summary
Pymodbus is a full Modbus protocol implementation using twisted/tornado/asyncio for its
asynchronous communications core. It can also be used without any third
party dependencies (aside from pyserial) if a more lightweight project is
needed. Furthermore, it should work fine under any python version > 2.7
needed. Furthermore, it should work fine under any python version >= 3.7
(including python 3+)


Expand Down
2 changes: 1 addition & 1 deletion doc/INSTALL
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Requirements
-------------

* Python 2.7 or later.
* Python 3.7 or later.
* Python Twisted, Tornado or asyncio (For async client and server)
* Pyserial

Expand Down
6 changes: 3 additions & 3 deletions doc/api/doxygen/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
'''
Doxygen API Builder
---------------------
Expand Down Expand Up @@ -29,8 +29,8 @@ def which(program):
return None

if which('doxygen') is not None:
print "Building Doxygen API Documentation"
print("Building Doxygen API Documentation")
os.system("doxygen .doxygen")
if os.path.exists('../../../build'):
shutil.move("html", "../../../build/doxygen")
else: print "Doxygen not available...not building"
else: print("Doxygen not available...not building")
8 changes: 4 additions & 4 deletions doc/api/epydoc/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
'''
Epydoc API Runner
------------------
Expand Down Expand Up @@ -27,12 +27,12 @@
if not os.path.exists("./html"):
os.mkdir("./html")

print "Building Epydoc API Documentation"
print( "Building Epydoc API Documentation")
cli()

if os.path.exists('../../../build'):
shutil.move("html", "../../../build/epydoc")
except Exception, ex:
except Exception as ex:
import traceback,sys
traceback.print_exc(file=sys.stdout)
print "Epydoc not avaliable...not building"
print( "Epydoc not avaliable...not building")
4 changes: 2 additions & 2 deletions doc/api/pydoc/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pydoc sub-class for generating documentation for entire packages.

Expand Down Expand Up @@ -447,7 +447,7 @@ def recurseScan(self, objectList):
if not os.path.exists("./html"):
os.mkdir("./html")

print "Building Pydoc API Documentation"
print( "Building Pydoc API Documentation")
PackageDocumentationGenerator(
baseModules = ['pymodbus', '__builtin__'],
destinationDirectory = "./html/",
Expand Down
7 changes: 4 additions & 3 deletions doc/api/pydoctor/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
'''
Pydoctor API Runner
---------------------
Expand All @@ -19,9 +19,10 @@
--html-output=html
--html-write-function-pages --make-html'''.split()

print "Building Pydoctor API Documentation"
print( "Building Pydoctor API Documentation")
main(sys.argv[1:])

if os.path.exists('../../../build'):
shutil.move("html", "../../../build/pydoctor")
except: print "Pydoctor unavailable...not building"
except:
print( "Pydoctor unavailable...not building")
28 changes: 11 additions & 17 deletions examples/common/async_asyncio_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand All @@ -8,22 +8,16 @@

The example is only valid on Python3.4 and above
"""
from pymodbus.compat import IS_PYTHON3, PYTHON_VERSION
if IS_PYTHON3 and PYTHON_VERSION >= (3, 4):
import asyncio
import logging
# ----------------------------------------------------------------------- #
# Import the required asynchronous client
# ----------------------------------------------------------------------- #
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient as ModbusClient
# from pymodbus.client.asynchronous.udp import (
# AsyncModbusUDPClient as ModbusClient)
from pymodbus.client.asynchronous import schedulers

else:
import sys
sys.stderr("This example needs to be run only on python 3.4 and above")
sys.exit(1)
import asyncio
import logging
# ----------------------------------------------------------------------- #
# Import the required asynchronous client
# ----------------------------------------------------------------------- #
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient as ModbusClient
# from pymodbus.client.asynchronous.udp import (
# AsyncModbusUDPClient as ModbusClient)
from pymodbus.client.asynchronous import schedulers


from threading import Thread
import time
Expand Down
19 changes: 7 additions & 12 deletions examples/common/async_asyncio_serial_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand All @@ -8,17 +8,12 @@

The example is only valid on Python3.4 and above
"""
from pymodbus.compat import IS_PYTHON3, PYTHON_VERSION
if IS_PYTHON3 and PYTHON_VERSION >= (3, 4):
import logging
import asyncio
from pymodbus.client.asynchronous.serial import (
AsyncModbusSerialClient as ModbusClient)
from pymodbus.client.asynchronous import schedulers
else:
import sys
sys.stderr("This example needs to be run only on python 3.4 and above")
sys.exit(1)
import logging
import asyncio
from pymodbus.client.asynchronous.serial import (
AsyncModbusSerialClient as ModbusClient)
from pymodbus.client.asynchronous import schedulers


# --------------------------------------------------------------------------- #
# configure the client logging
Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_tornado_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_tornado_client_serial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_twisted_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/async_twisted_client_serial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/asynchronous_processor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Processor Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/asynchronous_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asynchronous Server Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/asyncio_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Asyncio Server Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/callback_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Server With Callbacks
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/changing_framers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Client Framer Overload
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/custom_datablock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Server With Custom Datablock Side Effect
--------------------------------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions examples/common/custom_message.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Client Examples
--------------------------------------------------------------------------

The following is an example of how to use the synchronous modbus client
implementation from pymodbus.

It should be noted that the client can also be used with
the guard construct that is available in python 2.5 and up::

with ModbusClient('127.0.0.1') as client:
result = client.read_coils(1,10)
print result
Expand Down
5 changes: 1 addition & 4 deletions examples/common/custom_message_async_clients.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Client Examples
--------------------------------------------------------------------------

The following is an example of how to use the synchronous modbus client
implementation from pymodbus.

It should be noted that the client can also be used with
the guard construct that is available in python 2.5 and up::

with ModbusClient('127.0.0.1') as client:
result = client.read_coils(1,10)
print result
Expand Down
2 changes: 1 addition & 1 deletion examples/common/custom_synchronous_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Server Example with Custom functions
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/modbus_logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Logging Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/modbus_payload.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Payload Building/Decoding Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/modbus_payload_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Server Payload Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/performance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Performance Example
--------------------------------------------------------------------------
Expand Down
5 changes: 1 addition & 4 deletions examples/common/synchronous_client.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Client Examples
--------------------------------------------------------------------------

The following is an example of how to use the synchronous modbus client
implementation from pymodbus.

It should be noted that the client can also be used with
the guard construct that is available in python 2.5 and up::

with ModbusClient('127.0.0.1') as client:
result = client.read_coils(1,10)
print result
Expand Down
2 changes: 1 addition & 1 deletion examples/common/synchronous_client_ext.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Client Extended Examples
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/synchronous_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Synchronous Server Example
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/common/updating_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Pymodbus Server With Updating Thread
--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/asynchronous_asyncio_modbus_tls_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""
Simple Asynchronous Modbus TCP over TLS client
---------------------------------------------------------------------------
Expand Down
Loading