Skip to content

Commit d594b87

Browse files
authored
Remove twisted (#972)
Remove twisted.
1 parent fda755d commit d594b87

32 files changed

+60
-1666
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ jobs:
125125
run: |
126126
pip install --upgrade pip setuptools wheel
127127
pip install --upgrade tox
128-
- uses: twisted/python-info-action@v1.0.1
129128
- name: Add PyPy Externals
130129
if: ${{ matrix.os.matrix == 'windows' && matrix.python.implementation == 'pypy'}}
131130
env:
@@ -225,7 +224,6 @@ jobs:
225224
run: |
226225
pip install --upgrade pip setuptools wheel
227226
pip install --upgrade tox
228-
- uses: twisted/python-info-action@v1.0.1
229227
- name: Test
230228
continue-on-error: ${{ matrix.task.continue_on_error == true }}
231229
run: |
@@ -272,7 +270,6 @@ jobs:
272270
run: |
273271
pip install --upgrade pip setuptools wheel
274272
pip install --upgrade tox
275-
- uses: twisted/python-info-action@v1.0.1
276273
- name: Download Coverage
277274
if: matrix.task.download_coverage
278275
uses: actions/download-artifact@v2

README.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Remark: "Supports" means that we only test with those versions, lower versions (
3030
Summary
3131
------------------------------------------------------------
3232

33-
Pymodbus is a full Modbus protocol implementation using a synchronous or asynchronous core. The preferred mode for asynchronous communication is asyncio, however for the moment twisted are also supported (due to be removed or converted to a plugin in a later version).
33+
Pymodbus is a full Modbus protocol implementation using a synchronous or asynchronous (using asyncio) core.
3434

3535
Supported modbus communication modes: tcp, rtu-over-tcp, udp, serial, tls
3636

@@ -53,7 +53,7 @@ Client Features
5353
* Full read/write protocol on discrete and register
5454
* Most of the extended protocol (diagnostic/file/pipe/setting/information)
5555
* TCP, RTU-OVER-TCP, UDP, TLS, Serial ASCII, Serial RTU, and Serial Binary
56-
* asynchronous(powered by asyncio/twisted) and synchronous versions
56+
* asynchronous(powered by asyncio) and synchronous versions
5757
* Payload builder/decoder utilities
5858
* Pymodbus REPL for quick tests
5959
* Customable framer to allow for custom implementations
@@ -167,8 +167,6 @@ Available options are:
167167

168168
- **datastore**, installs databases (SQLAlchemy and Redit) for datastore.
169169

170-
- **twisted**, installs twisted as alternative to asyncio (will be removed in a future version).
171-
172170
- **documentation**, installs tools to generate documentation.
173171

174172
- **development**, installs development tools needed to enable test/check of pymodbus changes.
@@ -282,6 +280,5 @@ Pymodbus is built on top of code developed from/by:
282280
* Copyright (c) 2001-2005 S.W.A.C. Bohemia s.r.o., Czech Republic.
283281

284282
* Hynek Petrak, https://github.com/HynekPetrak
285-
* Twisted Matrix
286283

287284
Released under the `BSD License <LICENSE>`_

doc/source/library/pymodbus.server.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Submodules
1212
pymodbus\.server\.asynchronous module
1313
-------------------------------------
1414

15-
.. automodule:: pymodbus.server.asynchronous
15+
.. automodule:: pymodbus.server.async_io
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:
@@ -24,5 +24,3 @@ pymodbus\.server\.sync module
2424
:members:
2525
:undoc-members:
2626
:show-inheritance:
27-
28-

examples/common/asyncio_server.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
44
The asyncio server is implemented in pure python without any third
55
party libraries (unless you need to use the serial protocols which require
6-
asyncio-pyserial). This is helpful in constrained or old environments where using
7-
twisted is just not feasible. What follows is an example of its use:
6+
asyncio-pyserial). What follows is an example of its use:
87
"""
98
import asyncio
109

examples/common/callback_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ModbusSparseDataBlock,
1717
)
1818
from pymodbus.device import ModbusDeviceIdentification
19-
from pymodbus.server.asynchronous import StartTcpServer
19+
from pymodbus.server.async_io import StartTcpServer
2020

2121
# --------------------------------------------------------------------------- #
2222
# import the modbus libraries we need

examples/common/custom_datablock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
ModbusSparseDataBlock,
1414
)
1515
from pymodbus.device import ModbusDeviceIdentification
16-
from pymodbus.server.asynchronous import StartTcpServer
16+
from pymodbus.server.async_io import StartTcpServer
1717

1818
# --------------------------------------------------------------------------- #
1919
# import the modbus libraries we need

examples/common/dbstore_update_server.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
"""
1616
import logging
1717
import random
18-
19-
# --------------------------------------------------------------------------- #
20-
# import the twisted libraries we need
21-
# --------------------------------------------------------------------------- #
22-
from twisted.internet.task import LoopingCall
18+
import asyncio
2319

2420
from pymodbus.datastore import ModbusSequentialDataBlock, ModbusServerContext
2521
from pymodbus.datastore.database import SqlSlaveContext
2622
from pymodbus.device import ModbusDeviceIdentification
27-
from pymodbus.server.asynchronous import StartTcpServer
23+
from pymodbus.server.async_io import StartTcpServer
2824

2925
# --------------------------------------------------------------------------- #
3026
# import the modbus libraries we need
@@ -100,7 +96,7 @@ def run_dbstore_update_server():
10096
# run the server you want
10197
# ----------------------------------------------------------------------- #
10298
time = 5 # 5 seconds delay
103-
loop = LoopingCall(f=updating_writer, a=(context,))
99+
loop = asyncio.get_event_loop()
104100
loop.start(time, now=False) # initially delay by time
105101
loop.stop()
106102
StartTcpServer(context, identity=identity, address=("", 5020))

examples/common/updating_server.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,17 @@
1010
Thread(target=updating_writer, args=(context,)).start()
1111
"""
1212
import logging
13-
14-
# --------------------------------------------------------------------------- #
15-
# import the modbus libraries we need
16-
# --------------------------------------------------------------------------- #
17-
from twisted.internet.task import LoopingCall
13+
import asyncio
1814

1915
from pymodbus.datastore import (
2016
ModbusSequentialDataBlock,
2117
ModbusServerContext,
2218
ModbusSlaveContext,
2319
)
2420
from pymodbus.device import ModbusDeviceIdentification
25-
from pymodbus.server.asynchronous import StartTcpServer
21+
from pymodbus.server.async_io import StartTcpServer
2622
from pymodbus.version import version
2723

28-
# from pymodbus.transaction import ModbusRtuFramer, ModbusAsciiFramer
29-
30-
# --------------------------------------------------------------------------- #
31-
# import the twisted libraries we need
32-
# --------------------------------------------------------------------------- #
33-
3424
# --------------------------------------------------------------------------- #
3525
# configure the service logging
3626
# --------------------------------------------------------------------------- #
@@ -94,7 +84,7 @@ def run_updating_server():
9484
# run the server you want
9585
# ----------------------------------------------------------------------- #
9686
time = 5 # 5 seconds delay
97-
loop = LoopingCall(f=updating_writer, a=(context,))
87+
loop = asyncio.get_event_loop()
9888
loop.start(time, now=False) # initially delay by time
9989
StartTcpServer(context, identity=identity, address=("localhost", 5020))
10090

examples/contrib/libmodbus_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# -------------------------------------------------------------------------- #
2727
# import system libraries
2828
# -------------------------------------------------------------------------- #
29-
from cffi import FFI
29+
from cffi import FFI # pylint: disable=import-error
3030

3131
from pymodbus.bit_read_message import ReadCoilsResponse, ReadDiscreteInputsResponse
3232
from pymodbus.bit_write_message import (

examples/contrib/modbus_simulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pickle # nosec
1010

1111
from pymodbus.datastore import ModbusServerContext, ModbusSlaveContext
12-
from pymodbus.server.asynchronous import StartTcpServer
12+
from pymodbus.server.async_io import StartTcpServer
1313

1414
# -------------------------------------------------------------------------- #
1515
# Logging

0 commit comments

Comments
 (0)