Skip to contentSkip to conversation

Asynchronous OPC UP Python client

PATCH New Jugurtha BELKALEM 2 participants 5 messages Sep 4, 2020 – Sep 7, 2020

lore
Share & tools
lore
#0 lore raw

cover Asynchronous OPC UP Python client

Even though OPC UA SDKs provide synchronous versions (in addition to asynchronous APIs) for OPC UA operations; these should not be used as they block until timeout is reached or server's response reception arrives.

opcua-asyncio allows to create an asynchronous behaviour for a python OPC UA client.

Jugurtha BELKALEM (2):
package/python-aiofiles : new package
package/python-opcua-asyncio : new package

 DEVELOPERS                                             |  2 ++
 package/Config.in                                      |  2 ++
 package/python-aiofiles/Config.in                      |  8 ++++++++
 package/python-aiofiles/python-aiofiles.hash           |  5 +++++
 package/python-aiofiles/python-aiofiles.mk             | 14 ++++++++++++++
 package/python-opcua-asyncio/Config.in                 | 14 ++++++++++++++
 package/python-opcua-asyncio/python-opcua-asyncio.hash |  3 +++
 package/python-opcua-asyncio/python-opcua-asyncio.mk   | 14 ++++++++++++++
 8 files changed, 62 insertions(+)
 create mode 100644 package/python-aiofiles/Config.in
 create mode 100644 package/python-aiofiles/python-aiofiles.hash
 create mode 100644 package/python-aiofiles/python-aiofiles.mk
 create mode 100644 package/python-opcua-asyncio/Config.in
 create mode 100644 package/python-opcua-asyncio/python-opcua-asyncio.hash
 create mode 100644 package/python-opcua-asyncio/python-opcua-asyncio.mk
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 package/python-aiofiles : new package

Ordinary local file IO is blocking, and cannot easily and portably made asynchronous.
This means doing file IO may interfere with asyncio applications, which shouldn?t block the executing thread. aiofiles helps with this y introducing asynchronous versions of files that support delegating operations to a separate thread pool.

More information is available at :
https://pypi.org/project/aiofiles.

---
Package has been tested with check-package:

$ ./utils/check-package package/python-aiofiles/*
27 lines processed
0 warnings generated
 DEVELOPERS                                   |  1 +
 package/Config.in                            |  1 +
 package/python-aiofiles/Config.in            |  8 ++++++++
 package/python-aiofiles/python-aiofiles.hash |  5 +++++
 package/python-aiofiles/python-aiofiles.mk   | 14 ++++++++++++++
 5 files changed, 29 insertions(+)
 create mode 100644 package/python-aiofiles/Config.in
 create mode 100644 package/python-aiofiles/python-aiofiles.hash
 create mode 100644 package/python-aiofiles/python-aiofiles.mk
DEVELOPERS +1 -0
index d306c5f025..5f66576b6f 100644
@@ -1419,6 +1419,7 @@ N:	Joshua Henderson <[email protected]>
 F:	package/qt5/qt5wayland/
 
 N:	Jugurtha BELKALEM <[email protected]>
+F:	package/python-aiofiles/
 F:	package/python-cycler/
 F:	package/python-matplotlib/
 
package/Config.in +1 -0
index 3b6ced8f0f..f99fa83cd9 100644
@@ -856,6 +856,7 @@ menu "External python modules"
 	source "package/python-aiocoap/Config.in"
 	source "package/python-aioconsole/Config.in"
 	source "package/python-aiodns/Config.in"
+	source "package/python-aiofiles/Config.in"
 	source "package/python-aiohttp/Config.in"
 	source "package/python-aiohttp-cors/Config.in"
 	source "package/python-aiohttp-debugtoolbar/Config.in"
package/python-aiofiles/Config.in new file +8 -0
new file mode 100644
index 0000000000..9cc3d7fe59
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_AIOFILES
+	bool "python-aiofiles"
+	depends on BR2_PACKAGE_PYTHON3
+	help
+	  aiofiles aims to  handle local disk files in
+	  asyncio applications.
+
+	  https://pypi.org/project/aiofiles
package/python-aiofiles/python-aiofiles.hash new file +5 -0
new file mode 100644
index 0000000000..3c3e8565a3
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/aiofiles/json
+md5  2243eff06072115e8afe8907677ca51d  aiofiles-0.5.0.tar.gz
+sha256  98e6bcfd1b50f97db4980e182ddd509b7cc35909e903a8fe50d8849e02d815af  aiofiles-0.5.0.tar.gz
+# Locally computed sha256 checksums
+sha256  cb5e8e7e5f4a3988e1063c142c60dc2df75605f4c46515e776e3aca6df976e14  LICENSE
package/python-aiofiles/python-aiofiles.mk new file +14 -0
new file mode 100644
index 0000000000..28f41e3967
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-aiofiles
+#
+################################################################################
+
+PYTHON_AIOFILES_VERSION = 0.5.0
+PYTHON_AIOFILES_SOURCE = aiofiles-$(PYTHON_AIOFILES_VERSION).tar.gz
+PYTHON_AIOFILES_SITE = https://files.pythonhosted.org/packages/2b/64/437053d6a4ba3b3eea1044131a25b458489320cb9609e19ac17261e4dc9b
+PYTHON_AIOFILES_SETUP_TYPE = setuptools
+PYTHON_AIOFILES_LICENSE = Apache-2.0
+PYTHON_AIOFILES_LICENSE_FILES = LICENSE
+
+$(eval $(python-package))
Signature · 1 line
2.11.0
#2 lore raw

PATCH 1/2 package/python-aiofiles : new package

Quoted 10 lines · On Fri, 4 Sep 2020 16:33:00 +0200 Jugurtha BELKALEM…

Ordinary local file IO is blocking, and cannot easily and portably made asynchronous.
This means doing file IO may interfere with asyncio applications, which shouldn?t block the executing thread. aiofiles helps with this y introducing asynchronous versions of files that support delegating operations to a separate thread pool.

More information is available at :
https://pypi.org/project/aiofiles.

Quoted 6 lines

---
Package has been tested with check-package:

$ ./utils/check-package package/python-aiofiles/*
27 lines processed
0 warnings generated

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 2/2 package/python-opcua-asyncio : new package

In reply to Jugurtha BELKALEM

opcua-asyncio is an asyncio-based asynchronous OPC UA client based on python-opcua, removing hacks for support of python < 3.6.
Asynchronous programming allows for simpler code (e.g. less need for locks) and potentially performance gains.

More information is available at :
https://github.com/FreeOpcUa/opcua-asyncio.

---

Package has been tested with check-package:

$ ./utils/check-package package/python-opcua-asyncio/*
31 lines processed
0 warnings generated
 DEVELOPERS                                             |  1 +
 package/Config.in                                      |  1 +
 package/python-opcua-asyncio/Config.in                 | 14 ++++++++++++++
 package/python-opcua-asyncio/python-opcua-asyncio.hash |  3 +++
 package/python-opcua-asyncio/python-opcua-asyncio.mk   | 14 ++++++++++++++
 5 files changed, 33 insertions(+)
 create mode 100644 package/python-opcua-asyncio/Config.in
 create mode 100644 package/python-opcua-asyncio/python-opcua-asyncio.hash
 create mode 100644 package/python-opcua-asyncio/python-opcua-asyncio.mk
DEVELOPERS +1 -0
index 5f66576b6f..7a289c1e46 100644
@@ -1422,6 +1422,7 @@ N:	Jugurtha BELKALEM <[email protected]>
 F:	package/python-aiofiles/
 F:	package/python-cycler/
 F:	package/python-matplotlib/
+F:	package/python-opcua-asyncio/
 
 N:	Juha Rantanen <[email protected]>
 F:	package/acsccid/
package/Config.in +1 -0
index f99fa83cd9..7a351a6ccb 100644
@@ -1048,6 +1048,7 @@ menu "External python modules"
 	source "package/python-nfc/Config.in"
 	source "package/python-numpy/Config.in"
 	source "package/python-oauthlib/Config.in"
+	source "package/python-opcua-asyncio/Config.in"
 	source "package/python-packaging/Config.in"
 	source "package/python-paho-mqtt/Config.in"
 	source "package/python-pam/Config.in"
package/python-opcua-asyncio/Config.in new file +14 -0
new file mode 100644
index 0000000000..6dee004b9b
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_PYTHON_OPCUA_ASYNCIO
+	bool "python-opcua-asyncio"
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_DATEUTIL #runtime
+	select BR2_PACKAGE_PYTHON_PYTZ #runtime
+	select BR2_PACKAGE_PYTHON_LXML #runtime
+	select BR2_PACKAGE_PYTHON_CRYPTOGRAPHY #runtime
+	select BR2_PACKAGE_PYTHON_AIOFILES #runtime
+	help
+	  opcua-asyncio is an asyncio-based asynchronous
+	  OPC UA client based on python-opcua, removing
+	  hacks for support of python < 3.6.
+
+	  https://github.com/FreeOpcUa/opcua-asyncio
package/python-opcua-asyncio/python-opcua-asyncio.hash new file +3 -0
new file mode 100644
index 0000000000..2754c19059
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  e5fab37a92162351fe40cab43df09db8a2e9f8b8a2a8f13ed680aa6f6d687ec3  opcua-asyncio-0.8.4.tar.gz
+sha256  89480768826f408daea1f3caff0509c2cc9606e10f6bb0ccfd12a3d604842c35  COPYING
package/python-opcua-asyncio/python-opcua-asyncio.mk new file +14 -0
new file mode 100644
index 0000000000..febde48ba5
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-opcua-asyncio
+#
+################################################################################
+
+PYTHON_OPCUA_ASYNCIO_VERSION = 0.8.4
+PYTHON_OPCUA_ASYNCIO_SOURCE = opcua-asyncio-$(PYTHON_OPCUA_ASYNCIO_VERSION).tar.gz
+PYTHON_OPCUA_ASYNCIO_SITE = $(call github,FreeOpcUa,opcua-asyncio,$(PYTHON_OPCUA_ASYNCIO_VERSION))
+PYTHON_OPCUA_ASYNCIO_SETUP_TYPE = setuptools
+PYTHON_OPCUA_ASYNCIO_LICENSE = LGPL-3.0
+PYTHON_OPCUA_ASYNCIO_LICENSE_FILES = COPYING
+
+$(eval $(python-package))
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/2 package/python-opcua-asyncio : new package

Hello,

Thanks, I've applied to master, with a few changes. See below.

Quoted 6 lines · On Fri, 4 Sep 2020 16:33:01 +0200 Jugurtha BELKALEM…
package/python-opcua-asyncio/Config.in new file +0 -0
new file mode 100644
index 0000000000..6dee004b9b

package/python-opcua-asyncio/Config.in line 8

Quoted 8 lines
package/python-opcua-asyncio/Config.in new file +8 -0
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_PYTHON_OPCUA_ASYNCIO
+	bool "python-opcua-asyncio"
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_DATEUTIL #runtime
+	select BR2_PACKAGE_PYTHON_PYTZ #runtime
+	select BR2_PACKAGE_PYTHON_LXML #runtime
+	select BR2_PACKAGE_PYTHON_CRYPTOGRAPHY #runtime
+	select BR2_PACKAGE_PYTHON_AIOFILES #runtime

In general, we like to have such lists alphabetically sorted. Also we usually have a space after the # that marks the start of a comment.

package/python-opcua-asyncio/Config.in line 10

Quoted 2 lines
package/python-opcua-asyncio/Config.in new file +2 -0
+sha256  e5fab37a92162351fe40cab43df09db8a2e9f8b8a2a8f13ed680aa6f6d687ec3  opcua-asyncio-0.8.4.tar.gz
+sha256  89480768826f408daea1f3caff0509c2cc9606e10f6bb0ccfd12a3d604842c35  COPYING

This license file hash was incorrect. Did you test "make legal-info" with this package enabled ?

package/python-opcua-asyncio/Config.in

Quoted 5 lines
package/python-opcua-asyncio/Config.in new file +5 -0
+PYTHON_OPCUA_ASYNCIO_VERSION = 0.8.4
+PYTHON_OPCUA_ASYNCIO_SOURCE = opcua-asyncio-$(PYTHON_OPCUA_ASYNCIO_VERSION).tar.gz
+PYTHON_OPCUA_ASYNCIO_SITE = $(call github,FreeOpcUa,opcua-asyncio,$(PYTHON_OPCUA_ASYNCIO_VERSION))
+PYTHON_OPCUA_ASYNCIO_SETUP_TYPE = setuptools
+PYTHON_OPCUA_ASYNCIO_LICENSE = LGPL-3.0

The license really is LGPL-3.0+, as indicated in the setup.py file, so I fixed that as well.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com