dls-plc-tools 1.0.0b1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ """Top level API.
2
+
3
+ .. data:: __version__
4
+ :type: str
5
+
6
+ Version number as calculated by https://github.com/pypa/setuptools_scm
7
+ """
8
+
9
+ from ._version import __version__
10
+
11
+ __all__ = ["__version__"]
@@ -0,0 +1,24 @@
1
+ """Interface for ``python -m dls_plc_tools``."""
2
+
3
+ from argparse import ArgumentParser
4
+ from collections.abc import Sequence
5
+
6
+ from . import __version__
7
+
8
+ __all__ = ["main"]
9
+
10
+
11
+ def main(args: Sequence[str] | None = None) -> None:
12
+ """Argument parser for the CLI."""
13
+ parser = ArgumentParser()
14
+ parser.add_argument(
15
+ "-v",
16
+ "--version",
17
+ action="version",
18
+ version=__version__,
19
+ )
20
+ parser.parse_args(args)
21
+
22
+
23
+ if __name__ == "__main__":
24
+ main()
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '1.0.0b1'
22
+ __version_tuple__ = version_tuple = (1, 0, 0, 'b1')
23
+
24
+ __commit_id__ = commit_id = None
dls_plc_tools/gui.py ADDED
@@ -0,0 +1,433 @@
1
+ """Qt GUI for browsing and live-watching Omron NX PLC tags over EtherNet/IP.
2
+
3
+ Read-only: every PLC interaction is an explicit-messaging read, the same
4
+ mechanism the EPICS ether_ip driver uses.
5
+
6
+ Usage: dls-read-plc-gui [ip-address]
7
+ """
8
+
9
+ import argparse
10
+ import re
11
+ import sys
12
+
13
+ from aphyt import omron
14
+ from aphyt.cip.cip import CIPException
15
+ from aphyt.cip.cip_datatypes import CIPArray, CIPStructure
16
+ from openpyxl import Workbook
17
+ from PySide6.QtCore import QObject, Qt, QThread, QTimer, Signal, Slot
18
+ from PySide6.QtGui import QBrush, QColor
19
+ from PySide6.QtWidgets import (
20
+ QApplication,
21
+ QCheckBox,
22
+ QDoubleSpinBox,
23
+ QFileDialog,
24
+ QHBoxLayout,
25
+ QLabel,
26
+ QLineEdit,
27
+ QListWidget,
28
+ QListWidgetItem,
29
+ QMainWindow,
30
+ QPushButton,
31
+ QSplitter,
32
+ QTableWidget,
33
+ QTableWidgetItem,
34
+ QVBoxLayout,
35
+ QWidget,
36
+ )
37
+
38
+ from dls_plc_tools.interrogate import INFO_TAGS, USED_MARKER_MEMBER, dims_str
39
+
40
+ CHANGED_BRUSH = QBrush(QColor("#ffd54f")) # amber for values that just changed
41
+
42
+
43
+ def _sheet_name(name):
44
+ """Excel sheet names: max 31 chars, no []:*?/\\ characters."""
45
+ return re.sub(r"[\[\]:*?/\\]", "_", name)[:31]
46
+
47
+
48
+ def _cell(value):
49
+ """Coerce a CIP value into something openpyxl can store."""
50
+ return value if isinstance(value, int | float | str | bool) else str(value)
51
+
52
+
53
+ def _fit_columns(sheet, pad=2, cap=60):
54
+ """Size each column to its longest cell (openpyxl has no auto-fit)."""
55
+ for column in sheet.columns:
56
+ longest = max(len(str(c.value)) for c in column if c.value is not None)
57
+ sheet.column_dimensions[column[0].column_letter].width = min(longest + pad, cap)
58
+
59
+
60
+ class PlcWorker(QObject):
61
+ """Owns the aphyt connection; lives in a QThread so reads never block the UI."""
62
+
63
+ connected = Signal(str)
64
+ tags_ready = Signal(list)
65
+ struct_ready = Signal(str, object, object) # name, {member: values}, {member: type}
66
+ exported = Signal(str)
67
+ failed = Signal(str)
68
+
69
+ def __init__(self):
70
+ super().__init__()
71
+ self._eip = None
72
+
73
+ @Slot(str)
74
+ def connect_plc(self, ip):
75
+ try:
76
+ self.disconnect_plc()
77
+ eip = omron.NSeries()
78
+ eip.connect_explicit(ip, connection_timeout=5.0)
79
+ eip.register_session()
80
+ self._eip = eip
81
+ info = [ip]
82
+ for tag in INFO_TAGS:
83
+ try:
84
+ info.append(f"{tag}={eip.read_variable(tag)}")
85
+ except CIPException:
86
+ pass
87
+ self.connected.emit(" ".join(info))
88
+ except Exception as e:
89
+ self.failed.emit(f"connect: {e}")
90
+
91
+ @Slot()
92
+ def disconnect_plc(self):
93
+ if self._eip is not None:
94
+ try:
95
+ self._eip.close_explicit()
96
+ except Exception:
97
+ pass
98
+ self._eip = None
99
+
100
+ @Slot()
101
+ def list_tags(self):
102
+ if self._eip is None:
103
+ self.failed.emit("not connected")
104
+ return
105
+ try:
106
+ self._eip.update_variable_dictionary()
107
+ user = self._eip.connected_cip_dispatcher.user_variables
108
+ rows = []
109
+ for name, dtype in sorted(user.items()):
110
+ if isinstance(dtype, CIPStructure):
111
+ rows.append((name, dtype.variable_type_name))
112
+ else:
113
+ rows.append((name, type(dtype).__name__))
114
+ self.tags_ready.emit(rows)
115
+ except Exception as e:
116
+ self.failed.emit(f"list tags: {e}")
117
+
118
+ @Slot(str)
119
+ def read_struct(self, name):
120
+ if self._eip is None:
121
+ self.failed.emit("not connected")
122
+ return
123
+ try:
124
+ result = self._eip.read_variable(name)
125
+ columns = {}
126
+ types = {}
127
+ if isinstance(result, CIPStructure):
128
+ for member, value in result.members.items():
129
+ if isinstance(value, CIPArray):
130
+ columns[member] = value.value()
131
+ element = type(value.local_cip_data_type_object).__name__
132
+ types[member] = f"ARRAY[{dims_str(value)}] OF {element}"
133
+ else:
134
+ columns[member] = [value.value()]
135
+ types[member] = type(value).__name__
136
+ elif isinstance(result, CIPArray):
137
+ element = type(result.local_cip_data_type_object).__name__
138
+ columns[name] = result.value()
139
+ types[name] = f"ARRAY[{dims_str(result)}] OF {element}"
140
+ else: # scalar tag: one-cell table
141
+ columns[name] = [result]
142
+ types[name] = type(result).__name__
143
+ self.struct_ready.emit(name, columns, types)
144
+ except Exception as e:
145
+ self.failed.emit(f"read {name}: {e}")
146
+
147
+ @Slot(str)
148
+ def export_structs(self, path):
149
+ """Dump every published structure to an Excel workbook, one sheet per
150
+ structure: rows are members, columns are instance indices."""
151
+ if self._eip is None:
152
+ self.failed.emit("not connected")
153
+ return
154
+ try:
155
+ self._eip.update_variable_dictionary()
156
+ user = self._eip.connected_cip_dispatcher.user_variables
157
+ structs = sorted(n for n, d in user.items() if isinstance(d, CIPStructure))
158
+ workbook = Workbook()
159
+ default_sheet = workbook.active
160
+ if default_sheet is not None:
161
+ workbook.remove(default_sheet)
162
+ for name in structs:
163
+ result = self._eip.read_variable(name)
164
+ if not isinstance(result, CIPStructure):
165
+ continue
166
+ rows = {}
167
+ width = 1
168
+ for member, value in result.members.items():
169
+ if isinstance(value, CIPArray):
170
+ rows[member] = value.value()
171
+ else:
172
+ rows[member] = [value.value()]
173
+ width = max(width, len(rows[member]))
174
+ sheet = workbook.create_sheet(_sheet_name(name))
175
+ sheet.append([name] + list(range(width)))
176
+ for member, values in rows.items():
177
+ sheet.append([member] + [_cell(v) for v in values])
178
+ sheet.freeze_panes = "B2"
179
+ _fit_columns(sheet)
180
+ workbook.save(path)
181
+ self.exported.emit(f"exported {len(structs)} structures to {path}")
182
+ except Exception as e:
183
+ self.failed.emit(f"export: {e}")
184
+
185
+
186
+ class MainWindow(QMainWindow):
187
+ request_connect = Signal(str)
188
+ request_tags = Signal()
189
+ request_struct = Signal(str)
190
+ request_export = Signal(str)
191
+ request_disconnect = Signal()
192
+
193
+ def __init__(self, ip=None):
194
+ super().__init__()
195
+ self.setWindowTitle("DLS PLC tools")
196
+ self.resize(1100, 650)
197
+ self._waiting = False
198
+ self._current_struct = None
199
+ self._previous = {}
200
+
201
+ self._worker = PlcWorker()
202
+ self._thread = QThread(self)
203
+ self._worker.moveToThread(self._thread)
204
+ self.request_connect.connect(self._worker.connect_plc)
205
+ self.request_tags.connect(self._worker.list_tags)
206
+ self.request_struct.connect(self._worker.read_struct)
207
+ self.request_export.connect(self._worker.export_structs)
208
+ self.request_disconnect.connect(self._worker.disconnect_plc)
209
+ self._worker.connected.connect(self._on_connected)
210
+ self._worker.tags_ready.connect(self._on_tags)
211
+ self._worker.struct_ready.connect(self._on_struct)
212
+ self._worker.exported.connect(self._on_exported)
213
+ self._worker.failed.connect(self._on_failed)
214
+ self._thread.start()
215
+
216
+ self._timer = QTimer(self)
217
+ self._timer.timeout.connect(self._poll)
218
+
219
+ # Top bar: connection
220
+ self.ip_edit = QLineEdit(ip or "")
221
+ self.ip_edit.setPlaceholderText("e.g. 172.23.241.21")
222
+ self.ip_edit.setMaximumWidth(160)
223
+ self.connect_btn = QPushButton("Connect")
224
+ self.info_label = QLabel("not connected")
225
+ top = QHBoxLayout()
226
+ top.addWidget(QLabel("IP address:"))
227
+ top.addWidget(self.ip_edit)
228
+ top.addWidget(self.connect_btn)
229
+ top.addWidget(self.info_label, stretch=1)
230
+
231
+ # Left: tag browser
232
+ self.scan_btn = QPushButton("Scan tags (slow)")
233
+ self.export_btn = QPushButton("Export structures (Excel)")
234
+ self.tag_list = QListWidget()
235
+ left_box = QVBoxLayout()
236
+ left_box.addWidget(self.scan_btn)
237
+ left_box.addWidget(self.export_btn)
238
+ left_box.addWidget(self.tag_list)
239
+ left = QWidget()
240
+ left.setLayout(left_box)
241
+
242
+ # Right: live structure table
243
+ self.struct_edit = QLineEdit()
244
+ self.struct_edit.setPlaceholderText("tag to watch, e.g. Seq or PLC_Status")
245
+ self.watch_btn = QPushButton("Watch")
246
+ self.filter_edit = QLineEdit()
247
+ self.filter_edit.setPlaceholderText("filter members, e.g. Desc,State")
248
+ self.used_only = QCheckBox(f"in-use rows only ({USED_MARKER_MEMBER})")
249
+ self.used_only.setChecked(True)
250
+ self.interval = QDoubleSpinBox()
251
+ self.interval.setRange(0.5, 60.0)
252
+ self.interval.setValue(2.0)
253
+ self.interval.setSuffix(" s")
254
+ self.live = QCheckBox("live")
255
+ self.live.setChecked(True)
256
+ controls = QHBoxLayout()
257
+ controls.addWidget(self.struct_edit)
258
+ controls.addWidget(self.watch_btn)
259
+ controls.addWidget(self.filter_edit)
260
+ controls.addWidget(self.used_only)
261
+ controls.addWidget(QLabel("every"))
262
+ controls.addWidget(self.interval)
263
+ controls.addWidget(self.live)
264
+ self.table = QTableWidget()
265
+ self.table.setEditTriggers(QTableWidget.EditTrigger.NoEditTriggers)
266
+ right_box = QVBoxLayout()
267
+ right_box.addLayout(controls)
268
+ right_box.addWidget(self.table)
269
+ right = QWidget()
270
+ right.setLayout(right_box)
271
+
272
+ splitter = QSplitter()
273
+ splitter.addWidget(left)
274
+ splitter.addWidget(right)
275
+ splitter.setStretchFactor(1, 3)
276
+
277
+ central_box = QVBoxLayout()
278
+ central_box.addLayout(top)
279
+ central_box.addWidget(splitter, stretch=1)
280
+ central = QWidget()
281
+ central.setLayout(central_box)
282
+ self.setCentralWidget(central)
283
+
284
+ self.connect_btn.clicked.connect(self._connect_clicked)
285
+ self.ip_edit.returnPressed.connect(self._connect_clicked)
286
+ self.scan_btn.clicked.connect(self._scan_clicked)
287
+ self.export_btn.clicked.connect(self._export_clicked)
288
+ self.tag_list.itemDoubleClicked.connect(self._tag_activated)
289
+ self.watch_btn.clicked.connect(self._watch_clicked)
290
+ self.struct_edit.returnPressed.connect(self._watch_clicked)
291
+ self.interval.valueChanged.connect(self._interval_changed)
292
+ self.live.toggled.connect(self._live_toggled)
293
+
294
+ # --- user actions -------------------------------------------------
295
+
296
+ def _connect_clicked(self):
297
+ ip = self.ip_edit.text().strip()
298
+ if ip:
299
+ self.info_label.setText(f"connecting to {ip}...")
300
+ self.request_connect.emit(ip)
301
+
302
+ def _scan_clicked(self):
303
+ self.statusBar().showMessage("scanning tags (walks whole dictionary)...")
304
+ self.request_tags.emit()
305
+
306
+ def _tag_activated(self, item):
307
+ self.struct_edit.setText(item.data(Qt.ItemDataRole.UserRole))
308
+ self._watch_clicked()
309
+
310
+ def _export_clicked(self):
311
+ path, _ = QFileDialog.getSaveFileName(
312
+ self, "Export structures", "plc_structs.xlsx", "Excel files (*.xlsx)"
313
+ )
314
+ if path:
315
+ self.statusBar().showMessage(
316
+ "exporting (scans all tags, then reads every structure)..."
317
+ )
318
+ self.request_export.emit(path)
319
+
320
+ def _watch_clicked(self):
321
+ name = self.struct_edit.text().strip()
322
+ if not name:
323
+ return
324
+ self._current_struct = name
325
+ self._previous = {}
326
+ self.table.setRowCount(0)
327
+ self.table.setColumnCount(0)
328
+ self._poll(force=True)
329
+ self._interval_changed()
330
+
331
+ def _interval_changed(self):
332
+ self._timer.start(int(self.interval.value() * 1000))
333
+
334
+ def _live_toggled(self, checked):
335
+ if checked:
336
+ self._interval_changed()
337
+ else:
338
+ self._timer.stop()
339
+
340
+ def _poll(self, force=False):
341
+ if (
342
+ self._current_struct
343
+ and not self._waiting
344
+ and (force or self.live.isChecked())
345
+ ):
346
+ self._waiting = True
347
+ self.request_struct.emit(self._current_struct)
348
+
349
+ # --- worker results -----------------------------------------------
350
+
351
+ def _on_connected(self, info):
352
+ self.info_label.setText(info)
353
+ self.statusBar().showMessage("connected", 3000)
354
+
355
+ def _on_exported(self, message):
356
+ self.statusBar().showMessage(message, 10000)
357
+
358
+ def _on_failed(self, message):
359
+ self._waiting = False
360
+ self.statusBar().showMessage(message)
361
+
362
+ def _on_tags(self, rows):
363
+ self.tag_list.clear()
364
+ for name, type_name in rows:
365
+ item = QListWidgetItem(f"{name} — {type_name}")
366
+ item.setData(Qt.ItemDataRole.UserRole, name)
367
+ self.tag_list.addItem(item)
368
+ self.statusBar().showMessage(f"{len(rows)} user tags", 5000)
369
+
370
+ def _on_struct(self, name, columns, types):
371
+ self._waiting = False
372
+ if name != self._current_struct:
373
+ return
374
+
375
+ wanted = [
376
+ w.strip().lower() for w in self.filter_edit.text().split(",") if w.strip()
377
+ ]
378
+ members = [
379
+ m for m in columns if not wanted or any(w in m.lower() for w in wanted)
380
+ ]
381
+ labels = columns.get(USED_MARKER_MEMBER)
382
+ if self.used_only.isChecked() and labels:
383
+ rows = [i for i, v in enumerate(labels) if str(v).strip()]
384
+ else:
385
+ rows = list(range(max((len(v) for v in columns.values()), default=0)))
386
+
387
+ self.table.setColumnCount(len(members))
388
+ self.table.setRowCount(len(rows))
389
+ self.table.setHorizontalHeaderLabels(members)
390
+ for col, member in enumerate(members):
391
+ header = self.table.horizontalHeaderItem(col)
392
+ if header is not None:
393
+ header.setToolTip(types.get(member, ""))
394
+ self.table.setVerticalHeaderLabels([str(i) for i in rows])
395
+
396
+ previous = self._previous
397
+ current = {}
398
+ for col, member in enumerate(members):
399
+ values = columns[member]
400
+ for row, idx in enumerate(rows):
401
+ text = str(values[idx]).strip() if idx < len(values) else "n/a"
402
+ current[(member, idx)] = text
403
+ item = QTableWidgetItem(text)
404
+ if previous.get((member, idx), text) != text:
405
+ item.setBackground(CHANGED_BRUSH)
406
+ self.table.setItem(row, col, item)
407
+ self._previous = current
408
+ self.statusBar().showMessage(f"{name}: updated", 1500)
409
+
410
+ # --- shutdown -------------------------------------------------------
411
+
412
+ def closeEvent(self, event): # noqa: N802 - Qt override
413
+ self._timer.stop()
414
+ self.request_disconnect.emit()
415
+ self._thread.quit()
416
+ self._thread.wait(3000)
417
+ super().closeEvent(event)
418
+
419
+
420
+ def main():
421
+ parser = argparse.ArgumentParser(
422
+ description="Qt GUI for browsing Omron NX PLC tags over EtherNet/IP"
423
+ )
424
+ parser.add_argument("ip", nargs="?", help="PLC IP address to pre-fill")
425
+ args = parser.parse_args()
426
+ app = QApplication(sys.argv)
427
+ window = MainWindow(args.ip)
428
+ window.show()
429
+ sys.exit(app.exec())
430
+
431
+
432
+ if __name__ == "__main__":
433
+ main()
@@ -0,0 +1,241 @@
1
+ """
2
+ Summarise the structure tags published by an Omron NX PLC over EtherNet/IP.
3
+
4
+ With only an IP address, walks the PLC's tag dictionary and summarises every
5
+ published structure it finds. See --help for tag listing, member detail and
6
+ live value watching.
7
+ """
8
+
9
+ import argparse
10
+ import time
11
+ from collections import Counter
12
+
13
+ from aphyt import omron
14
+ from aphyt.cip.cip import CIPException
15
+ from aphyt.cip.cip_datatypes import CIPArray, CIPStructure
16
+
17
+ # Tags printed as a header for every mode.
18
+ INFO_TAGS = ["PLC_Name", "PLC_Status", "Epics_Num_dev"]
19
+
20
+ # Structure member whose non-empty entries mark instances actually in use.
21
+ USED_MARKER_MEMBER = "Desc"
22
+
23
+ # Default columns for --detail; override per-run with --members.
24
+ WATCH_MEMBERS = ["Desc", "State", "Status", "Status_String", "ILK_Status"]
25
+
26
+ MAX_CELL_WIDTH = 24
27
+ CHANGED = "\x1b[1;33m" # bold yellow
28
+ RESET = "\x1b[0m"
29
+ CLEAR = "\x1b[H\x1b[2J"
30
+
31
+
32
+ def dims_str(member):
33
+ return ", ".join(
34
+ f"{s}..{s + n - 1}"
35
+ for s, n in zip(
36
+ member.start_array_elements, member.number_of_elements, strict=True
37
+ )
38
+ )
39
+
40
+
41
+ def summarise_struct(name, struct):
42
+ print(f"\n{name}: {struct.variable_type_name}")
43
+
44
+ arrays = {m: v for m, v in struct.members.items() if isinstance(v, CIPArray)}
45
+ scalars = [m for m in struct.members if m not in arrays]
46
+
47
+ for dims, count in Counter(dims_str(v) for v in arrays.values()).most_common():
48
+ print(f" {count} array members of ARRAY[{dims}]")
49
+ if scalars:
50
+ print(f" scalar members: {', '.join(scalars)}")
51
+
52
+ marker = arrays.get(USED_MARKER_MEMBER)
53
+ if marker is not None:
54
+ try:
55
+ start = marker.start_array_elements[0]
56
+ used = [i + start for i, v in enumerate(marker.value()) if str(v).strip()]
57
+ print(
58
+ f" instances in use ({USED_MARKER_MEMBER} non-empty): "
59
+ f"{len(used)} -> {used}"
60
+ )
61
+ except Exception as e:
62
+ print(f" (could not decode {USED_MARKER_MEMBER}: {e})")
63
+
64
+
65
+ def list_all_tags(eip):
66
+ """Walk the PLC's full tag dictionary and print every published user tag."""
67
+ eip.update_variable_dictionary()
68
+ user_variables = eip.connected_cip_dispatcher.user_variables
69
+ for name, dtype in sorted(user_variables.items()):
70
+ if isinstance(dtype, CIPStructure):
71
+ print(f" {name} {dtype.variable_type_name}")
72
+ else:
73
+ print(f" {name} {type(dtype).__name__}")
74
+ system_count = len(eip.connected_cip_dispatcher.system_variables)
75
+ print(f"\n{len(user_variables)} user tags ({system_count} system tags not shown)")
76
+
77
+
78
+ def member_values(struct_instance, member):
79
+ """Return a member's contents as a list, or None if it is missing."""
80
+ value = struct_instance.members.get(member)
81
+ if value is None:
82
+ return None
83
+ if isinstance(value, CIPArray):
84
+ return value.value()
85
+ return [value.value()] # scalar member: single-row column
86
+
87
+
88
+ def show_struct(eip, struct):
89
+ """Print every member of a structure with its type and array bounds."""
90
+ result = eip.read_variable(struct)
91
+ if not isinstance(result, CIPStructure):
92
+ print(f"{struct} is a {type(result).__name__}, not a structure")
93
+ return
94
+ print(f"\n{struct}: {result.variable_type_name}")
95
+ for name, member in result.members.items():
96
+ if isinstance(member, CIPArray):
97
+ element = type(member.local_cip_data_type_object).__name__
98
+ print(f" {name} ARRAY[{dims_str(member)}] OF {element}")
99
+ else:
100
+ print(f" {name} {type(member).__name__}")
101
+
102
+
103
+ def watch_struct(eip, ip, struct, members, interval):
104
+ """Poll a structure and redraw a live table of the selected members.
105
+
106
+ Reads the whole structure in one request sequence per refresh (read-only
107
+ explicit messaging, the same mechanism the EPICS ether_ip driver uses),
108
+ then picks the displayed members out client-side.
109
+ """
110
+ rows = None
111
+ previous = {}
112
+ while True:
113
+ result = eip.read_variable(struct)
114
+ if not isinstance(result, CIPStructure):
115
+ print(f"{struct} is a {type(result).__name__}, not a structure")
116
+ return
117
+ if all(m not in result.members for m in members):
118
+ print(f"none of [{', '.join(members)}] exist in {struct}")
119
+ print(f"pick some of its members with -m: {', '.join(result.members)}")
120
+ return
121
+ columns = {m: member_values(result, m) for m in members}
122
+
123
+ if rows is None:
124
+ labels = member_values(result, USED_MARKER_MEMBER)
125
+ if labels:
126
+ rows = [i for i, v in enumerate(labels) if str(v).strip()]
127
+ else: # no marker member: show every index of the first column
128
+ first = next(v for v in columns.values() if v is not None)
129
+ rows = list(range(len(first)))
130
+
131
+ cells = {}
132
+ widths = {}
133
+ for member, values in columns.items():
134
+ widths[member] = len(member)
135
+ for idx in rows:
136
+ if values is None or idx >= len(values):
137
+ text = "n/a"
138
+ else:
139
+ text = str(values[idx]).strip()[:MAX_CELL_WIDTH]
140
+ changed = previous.get((member, idx), text) != text
141
+ previous[(member, idx)] = text
142
+ cells[(member, idx)] = (text, changed)
143
+ widths[member] = max(widths[member], len(text))
144
+
145
+ lines = [
146
+ f"{struct} @ {ip} {time.strftime('%H:%M:%S')} "
147
+ f"(every {interval}s, read-only) Ctrl-C to stop",
148
+ "",
149
+ " idx " + " ".join(m.ljust(widths[m]) for m in members),
150
+ ]
151
+ for idx in rows:
152
+ line = f" {idx:>3} "
153
+ for member in members:
154
+ text, changed = cells[(member, idx)]
155
+ padded = text.ljust(widths[member])
156
+ if changed:
157
+ padded = f"{CHANGED}{padded}{RESET}"
158
+ line += padded + " "
159
+ lines.append(line.rstrip())
160
+
161
+ print(CLEAR + "\n".join(lines), flush=True)
162
+ time.sleep(interval)
163
+
164
+
165
+ def main():
166
+ parser = argparse.ArgumentParser(description=__doc__)
167
+ parser.add_argument("ip", help="PLC IP address")
168
+ parser.add_argument(
169
+ "-l",
170
+ "--list",
171
+ action="store_true",
172
+ help="list every published user tag and its type "
173
+ "(slow: walks the whole tag dictionary)",
174
+ )
175
+ parser.add_argument(
176
+ "-d",
177
+ "--detail",
178
+ metavar="STRUCT",
179
+ help="live-updating table of one structure's values, e.g. -d Seq",
180
+ )
181
+ parser.add_argument(
182
+ "-s",
183
+ "--show",
184
+ metavar="STRUCT",
185
+ help="show one structure's members with types and array bounds, e.g. -s PID",
186
+ )
187
+ parser.add_argument(
188
+ "-m",
189
+ "--members",
190
+ help="comma-separated members to show with --detail "
191
+ f"(default: {','.join(WATCH_MEMBERS)})",
192
+ )
193
+ parser.add_argument(
194
+ "--interval",
195
+ type=float,
196
+ default=2.0,
197
+ help="refresh period in seconds for --detail (default: 2.0, min: 0.5)",
198
+ )
199
+ args = parser.parse_args()
200
+
201
+ with omron.NSeries(args.ip) as eip:
202
+ print(f"PLC at {args.ip}")
203
+ for tag in INFO_TAGS:
204
+ try:
205
+ print(f" {tag} = {eip.read_variable(tag)}")
206
+ except CIPException:
207
+ print(f" {tag}: not published")
208
+
209
+ if args.list:
210
+ list_all_tags(eip)
211
+ return
212
+
213
+ if args.show:
214
+ try:
215
+ show_struct(eip, args.show)
216
+ except CIPException:
217
+ print(f"{args.show}: not published on this PLC")
218
+ return
219
+
220
+ if args.detail:
221
+ members = args.members.split(",") if args.members else WATCH_MEMBERS
222
+ interval = max(args.interval, 0.5)
223
+ watch_struct(eip, args.ip, args.detail, members, interval)
224
+ return
225
+
226
+ # Default mode: discover structure tags from the dictionary walk,
227
+ # then read each one to summarise it.
228
+ eip.update_variable_dictionary()
229
+ user_variables = eip.connected_cip_dispatcher.user_variables
230
+ structs = sorted(
231
+ name
232
+ for name, dtype in user_variables.items()
233
+ if isinstance(dtype, CIPStructure)
234
+ )
235
+ print(f"\n{len(structs)} structure tags: {', '.join(structs)}")
236
+ for name in structs:
237
+ summarise_struct(name, eip.read_variable(name))
238
+
239
+
240
+ if __name__ == "__main__":
241
+ main()
@@ -0,0 +1,309 @@
1
+ Metadata-Version: 2.4
2
+ Name: dls-plc-tools
3
+ Version: 1.0.0b1
4
+ Summary: A collection of tools to facilitate EPICS commissioning of PLC based systems
5
+ Author-email: Lee Hudson <lee.hudson@diamond.ac.uk>
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "{}"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright {yyyy} {name of copyright owner}
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+ Project-URL: GitHub, https://github.com/DiamondLightSource/dls-plc-tools
209
+ Classifier: Development Status :: 3 - Alpha
210
+ Classifier: License :: OSI Approved :: Apache Software License
211
+ Classifier: Programming Language :: Python :: 3.11
212
+ Classifier: Programming Language :: Python :: 3.12
213
+ Classifier: Programming Language :: Python :: 3.13
214
+ Classifier: Programming Language :: Python :: 3.14
215
+ Requires-Python: >=3.11
216
+ Description-Content-Type: text/markdown
217
+ License-File: LICENSE
218
+ Requires-Dist: aphyt
219
+ Requires-Dist: PySide6-Essentials<6.10
220
+ Requires-Dist: openpyxl
221
+ Dynamic: license-file
222
+
223
+ [![CI](https://github.com/DiamondLightSource/dls-plc-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/dls-plc-tools/actions/workflows/ci.yml)
224
+ [![Coverage](https://codecov.io/gh/DiamondLightSource/dls-plc-tools/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/dls-plc-tools)
225
+ [![PyPI](https://img.shields.io/pypi/v/dls-plc-tools.svg)](https://pypi.org/project/dls-plc-tools)
226
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
227
+
228
+ # dls_plc_tools
229
+
230
+ Tools for interrogating Omron NX PLCs over EtherNet/IP, to support EPICS
231
+ commissioning of PLC-based vacuum systems at Diamond Light Source.
232
+
233
+ They let you browse the tags a PLC publishes, inspect the layout of its
234
+ structures, and watch values update live — without a Sysmac Studio licence or
235
+ physical access to the controller. Everything is **read-only explicit
236
+ messaging**: the same mechanism the EPICS `ether_ip` driver uses, serviced in
237
+ the controller's spare time, so it is safe to run against production PLCs.
238
+
239
+ There are two front-ends over the [`aphyt`](https://pypi.org/project/aphyt/)
240
+ library: a command-line tool (`dls-read-plc`) and a PySide6 desktop GUI
241
+ (`dls-read-plc-gui`).
242
+
243
+ What | Where
244
+ :---: | :---:
245
+ Source | <https://github.com/DiamondLightSource/dls-plc-tools>
246
+ PyPI | `pip install dls-plc-tools`
247
+ Docker | `docker run ghcr.io/diamondlightsource/dls-plc-tools:latest`
248
+ Releases | <https://github.com/DiamondLightSource/dls-plc-tools/releases>
249
+
250
+ ## Command-line tool
251
+
252
+ With just an IP address, `dls-read-plc` discovers every published
253
+ structure tag on the PLC and summarises each one — its member layout and how
254
+ many instances are actually in use:
255
+
256
+ ```
257
+ dls-read-plc 172.23.x.x
258
+ ```
259
+
260
+ Other modes:
261
+
262
+ ```
263
+ dls-read-plc 172.23.x.x -l # list every published tag and its type
264
+ dls-read-plc 172.23.x.x -s Seq # show one structure's members and array bounds
265
+ dls-read-plc 172.23.x.x -d Seq # live-updating table of a structure's values
266
+ dls-read-plc 172.23.x.x -d Seq -m Desc,State,Status # choose which members to watch
267
+ ```
268
+
269
+ `--detail`/`-d` redraws a table every 2 seconds (floor 0.5 s, set with
270
+ `--interval`), highlighting cells that have changed. Press Ctrl-C to stop. See
271
+ `dls-read-plc --help` for the full option list.
272
+
273
+ ## GUI
274
+
275
+ ```
276
+ dls-read-plc-gui 172.23.x.x
277
+ ```
278
+
279
+ `dls-read-plc-gui` gives you a browsable list of the PLC's published tags, a live
280
+ table of a selected structure's values (changed cells flash amber), and an
281
+ export of the discovered structure layouts to an Excel spreadsheet. The IP
282
+ address argument is optional — you can also enter it in the window.
283
+
284
+ ## Installation
285
+
286
+ ```
287
+ pip install dls-plc-tools
288
+ ```
289
+
290
+ Or, for development, using [uv](https://docs.astral.sh/uv/):
291
+
292
+ ```
293
+ git clone https://github.com/DiamondLightSource/dls-plc-tools.git
294
+ cd dls-plc-tools
295
+ uv sync
296
+ uv run dls-read-plc <ip>
297
+ ```
298
+
299
+ ## Notes
300
+
301
+ - These tools only ever **read**. They never write to the controller, never
302
+ start a keep-alive poll, and keep at most one request in flight. Poll rates
303
+ default to ~2 s and are floored at 0.5 s.
304
+ - Tags are visible over EtherNet/IP only if they are globals with **Network
305
+ Publish** set in Sysmac Studio, plus the controller's `_`-prefixed system
306
+ variables. Enumeration uses Omron's Tag Name Server object (CIP class 0x6A).
307
+ - DLS structures are structure-of-arrays: `Seq.Interfc[1]` is instance 1, with
308
+ index 0 reserved as padding. A non-empty `Desc` entry marks an instance that
309
+ is actually in use.
@@ -0,0 +1,13 @@
1
+ dls_plc_tools/__init__.py,sha256=Ksms_WJF8LTkbm38gEpm1jBpGqcQ8NGvmb2ZJlOE1j8,198
2
+ dls_plc_tools/__main__.py,sha256=ukbWFuT5ZuGM0fx6Cgruti5CulUB-MJpYfL-zayiMmQ,483
3
+ dls_plc_tools/_version.py,sha256=g-APWZSn1knLVTjqPp_TMtEX7rVFXNkdsvigOIU8Mnc,528
4
+ dls_plc_tools/gui.py,sha256=FiIFT9UO-5JINvY09ZdNt1Lzw-gW-qdUOMIhslGUfUU,15710
5
+ dls_plc_tools/interrogate.py,sha256=J0X_36aP_b2whq_ka-M2A8_bR_dQucigBM26JOChOYg,8513
6
+ dls_plc_tools-1.0.0b1.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
7
+ dls_plc_tools-1.0.0b1.dist-info/METADATA,sha256=QcLWxSPiTaDn6WF6IWHX-CQGATYy2d5Y-TBwK_rvMuw,17333
8
+ dls_plc_tools-1.0.0b1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
9
+ dls_plc_tools-1.0.0b1.dist-info/entry_points.txt,sha256=OMcu__WHPbzJh-PXksHSToQu7M5qXeJ-oz1VYKGo8UE,150
10
+ dls_plc_tools-1.0.0b1.dist-info/scm_file_list.json,sha256=_bs-ON96jexSdl1R1hCbYe1dBpL6doVnfkw9cYaqqNE,1134
11
+ dls_plc_tools-1.0.0b1.dist-info/scm_version.json,sha256=-Xphms0fOmuSKFBEiKvbaJwiTYXm7AaBCcZveogqCe0,162
12
+ dls_plc_tools-1.0.0b1.dist-info/top_level.txt,sha256=PhodyMhs7VIKly5c5d45712Dl1kRHWa6VW7Df0FlSk0,14
13
+ dls_plc_tools-1.0.0b1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ dls-plc-tools = dls_plc_tools.__main__:main
3
+ dls-read-plc = dls_plc_tools.interrogate:main
4
+ dls-read-plc-gui = dls_plc_tools.gui:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,41 @@
1
+ {
2
+ "files": [
3
+ ".pre-commit-config.yaml",
4
+ "README.md",
5
+ "uv.lock",
6
+ "Dockerfile",
7
+ ".python-version",
8
+ "LICENSE",
9
+ "pyproject.toml",
10
+ "catalog-info.yaml",
11
+ "renovate.json",
12
+ "CLAUDE.md",
13
+ ".gitleaks.toml",
14
+ ".gitignore",
15
+ ".copier-answers.yml",
16
+ ".devcontainer/devcontainer.json",
17
+ ".vscode/tasks.json",
18
+ ".vscode/launch.json",
19
+ ".vscode/settings.json",
20
+ ".vscode/extensions.json",
21
+ "src/dls_plc_tools/__init__.py",
22
+ "src/dls_plc_tools/interrogate.py",
23
+ "src/dls_plc_tools/gui.py",
24
+ "src/dls_plc_tools/__main__.py",
25
+ "tests/conftest.py",
26
+ "tests/test_cli.py",
27
+ ".github/CONTRIBUTING.md",
28
+ ".github/PULL_REQUEST_TEMPLATE/pull_request_template.md",
29
+ ".github/pages/index.html",
30
+ ".github/pages/make_switcher.py",
31
+ ".github/ISSUE_TEMPLATE/bug_report.md",
32
+ ".github/ISSUE_TEMPLATE/issue.md",
33
+ ".github/workflows/_pypi.yml",
34
+ ".github/workflows/_container.yml",
35
+ ".github/workflows/_release.yml",
36
+ ".github/workflows/_test.yml",
37
+ ".github/workflows/ci.yml",
38
+ ".github/workflows/_tox.yml",
39
+ ".github/workflows/_dist.yml"
40
+ ]
41
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.0.0b1",
3
+ "distance": 0,
4
+ "node": "g34a248c31e01933ceaf4a5c47fc4ec74bfd70470",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-07-13"
8
+ }
@@ -0,0 +1 @@
1
+ dls_plc_tools