A library to generate OPC UA artifacts based on an xml nodeset (or a server) and target nodes, as well as an automated OPC UA server documentation builder.
Install the module in editable mode for development:
pip install -e .[dev]
OPC UA Client Generator (Python)
This generates a typed client for a voraus OPC UA specification in form of a nodeset.
voraus-opcua-generator build-client-package motion_nodes.xml /tmp/my_robot_control_package/
OPC UA Server XML Builder
The XML builder creates a OPC UA specification of a running OPC UA Server.
voraus-opcua-generator build-xml motion_nodes.xml
OPC UA Server Documentation Builder
The documentation builder for OPC UA server XML files creates RST files for all nodes including methods and variables. Code examples for each node are also generated. Note that the documentation builder will create a subdirectory including the documentation folder, which must not be committed. You also have to include the base rst file to the doctree of your index.rst file.
voraus-opcua-generator build-docs motion_nodes.xml docs/
How to use
Use the tools to configure own generator, all classes can be generated to a single file or multiple schemas can be generated to multiple files
# setup parser
schema_parser = NodesetParser("nodeset.xml") # or ClientParser("opc.tcp://<ip>:<port>")
# select target nodes
target_nodes: List[ua.NodeId] = [
ua.NodeId(8100104, 1), # classify camera image
ua.NodeId(8200101, 1), # detect objects
ua.NodeId(8310101, 1), # find qr codes
ua.NodeId(4200102, 1), # apply camera setting
]
# parse schema
schema = schema_parser.parse(target_nodes)
# set override options
override_options: List[OverrideOptions] = [
OverrideOptions(
node_id=ua.NodeId.from_string("ns=1;i=100210"),
name="Motion",
),
]
# generate code
code = generate_code(schema, override_options)
# write to file
with open(<filename>, "w") as file:
file.write(code)
Metadata
Release files for voraus-opcua-generator 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| voraus_opcua_generator-0.14.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / voraus_opcua_generator-0.14.0-py3-none-any.whl
| Download URL | voraus_opcua_generator-0.14.0-py3-none-any.whl |
|---|---|
| Size | 47.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
884ef01b8d1d78218a8f0c4bdc28d89da497247fcdff167074c7576532ba811b
|
|
BLAKE2b-256 checksum How to use checksums |
a4b9966f7ec905958b6a5c26af546fb720ddbdbfdf0513a7b5f88cf7499047a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|