Replies: 1 comment
-
You can create script, that parses the nodeset xml and then create a python file like this for typ hints:
or you could make a test server with a modified version of asyncua, which then loads the nodes and outputs the conten of: opcua-asyncio/asyncua/common/structures104.py Line 306 in 302c434 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am writing a opcua-asyncio server application which communicates with a PLC.
We have a few structures defined for our communication. What I am trying to accomplish is getting typehints in my editor for these structures. So far I've tried:
1. Creating dataclasses, then manually creating OPCUA structures with
new_struct
from these dataclasses on the serverthis seemingly solves the problem, There are typehints when I edit the code, but there are 2 places where I have to manually maintain the structures (in the dataclasses and in the actual
new_struct
calls). I don't like it.2. Importing the OPCUA structures from a nodeset file with
import_xml
The idea behind this was to autogenerate dataclasses code from a nodeset file. We would still need to import the correct latest nodeset, but at least the nodeset file becomes the single maintenance point for both the server and client.
The structures are imported in the
ua
module and I can inspect the generated dataclasses, but there are no typehints when I edit the code, and I have no idea how could I get them.I'd like to hear other people's ideas and opinions about this :-)
pic: that's what I'm looking for
Beta Was this translation helpful? Give feedback.
All reactions