python-snap7 3.2.0__tar.gz → 3.2.1__tar.gz

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.
Files changed (142) hide show
  1. python_snap7-3.2.1/CHANGES.md +373 -0
  2. python_snap7-3.2.1/MANIFEST.in +9 -0
  3. {python_snap7-3.2.0/python_snap7.egg-info → python_snap7-3.2.1}/PKG-INFO +5 -1
  4. {python_snap7-3.2.0 → python_snap7-3.2.1}/README.rst +3 -0
  5. python_snap7-3.2.1/doc/API/client-base.rst +9 -0
  6. python_snap7-3.2.1/doc/API/client.rst +45 -0
  7. python_snap7-3.2.1/doc/API/connection.rst +8 -0
  8. python_snap7-3.2.1/doc/API/datatypes.rst +7 -0
  9. python_snap7-3.2.1/doc/API/demo.rst +9 -0
  10. python_snap7-3.2.1/doc/API/discovery.rst +7 -0
  11. python_snap7-3.2.1/doc/API/error.rst +5 -0
  12. python_snap7-3.2.1/doc/API/log.rst +33 -0
  13. python_snap7-3.2.1/doc/API/logo.rst +5 -0
  14. python_snap7-3.2.1/doc/API/optimizer.rst +79 -0
  15. python_snap7-3.2.1/doc/API/partner.rst +24 -0
  16. python_snap7-3.2.1/doc/API/ppi.rst +10 -0
  17. python_snap7-3.2.1/doc/API/rate-limiter.rst +10 -0
  18. python_snap7-3.2.1/doc/API/s7protocol.rst +7 -0
  19. python_snap7-3.2.1/doc/API/server.rst +19 -0
  20. python_snap7-3.2.1/doc/API/szl.rst +8 -0
  21. python_snap7-3.2.1/doc/API/tags.rst +97 -0
  22. python_snap7-3.2.1/doc/API/type.rst +5 -0
  23. python_snap7-3.2.1/doc/API/util.rst +24 -0
  24. python_snap7-3.2.1/doc/Makefile +153 -0
  25. python_snap7-3.2.1/doc/advanced.rst +90 -0
  26. python_snap7-3.2.1/doc/cli.rst +191 -0
  27. python_snap7-3.2.1/doc/conf.py +92 -0
  28. python_snap7-3.2.1/doc/connecting.rst +183 -0
  29. python_snap7-3.2.1/doc/connection-issues.rst +190 -0
  30. python_snap7-3.2.1/doc/development.rst +86 -0
  31. python_snap7-3.2.1/doc/error-reference.rst +57 -0
  32. python_snap7-3.2.1/doc/index.rst +76 -0
  33. python_snap7-3.2.1/doc/installation.rst +60 -0
  34. python_snap7-3.2.1/doc/introduction.rst +65 -0
  35. python_snap7-3.2.1/doc/limitations.rst +29 -0
  36. python_snap7-3.2.1/doc/multi-variable.rst +51 -0
  37. python_snap7-3.2.1/doc/plc-support.rst +93 -0
  38. python_snap7-3.2.1/doc/ppi.rst +67 -0
  39. python_snap7-3.2.1/doc/reading-writing.rst +437 -0
  40. python_snap7-3.2.1/doc/real-plc-testing.rst +89 -0
  41. python_snap7-3.2.1/doc/server.rst +113 -0
  42. python_snap7-3.2.1/doc/thread-safety.rst +39 -0
  43. python_snap7-3.2.1/doc/tia-portal-config.rst +56 -0
  44. python_snap7-3.2.1/example/boolean.py +46 -0
  45. python_snap7-3.2.1/example/db1_layout.txt +46 -0
  46. python_snap7-3.2.1/example/db_layouts.py +123 -0
  47. python_snap7-3.2.1/example/example.py +201 -0
  48. python_snap7-3.2.1/example/logo_7_8.py +53 -0
  49. python_snap7-3.2.1/example/ppi.py +13 -0
  50. python_snap7-3.2.1/example/prometheus_metrics.py +166 -0
  51. python_snap7-3.2.1/example/read_multi.py +68 -0
  52. python_snap7-3.2.1/example/s7_symbols.py +38 -0
  53. python_snap7-3.2.1/example/write_multi.py +52 -0
  54. {python_snap7-3.2.0 → python_snap7-3.2.1}/pyproject.toml +8 -2
  55. {python_snap7-3.2.0 → python_snap7-3.2.1/python_snap7.egg-info}/PKG-INFO +5 -1
  56. {python_snap7-3.2.0 → python_snap7-3.2.1}/python_snap7.egg-info/SOURCES.txt +67 -1
  57. {python_snap7-3.2.0 → python_snap7-3.2.1}/python_snap7.egg-info/requires.txt +1 -0
  58. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/async_client.py +76 -66
  59. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/client.py +82 -89
  60. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/client_base.py +75 -2
  61. python_snap7-3.2.1/snap7/py.typed +0 -0
  62. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/s7protocol.py +170 -134
  63. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/server/__init__.py +178 -220
  64. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/util/getters.py +5 -5
  65. python_snap7-3.2.1/tests/__init__.py +0 -0
  66. python_snap7-3.2.1/tests/conftest.py +189 -0
  67. python_snap7-3.2.1/tests/features/real_plc/connection.feature +17 -0
  68. python_snap7-3.2.1/tests/features/real_plc/lifecycle.feature +19 -0
  69. python_snap7-3.2.1/tests/features/real_plc/read.feature +19 -0
  70. python_snap7-3.2.1/tests/features/real_plc/report.schema.json +32 -0
  71. python_snap7-3.2.1/tests/features/real_plc/write.feature +23 -0
  72. python_snap7-3.2.1/tests/plc_setup/e2e_test_dbs.scl +160 -0
  73. python_snap7-3.2.1/tests/real_plc/__init__.py +1 -0
  74. python_snap7-3.2.1/tests/real_plc/reporting.py +123 -0
  75. python_snap7-3.2.1/tests/real_plc/support.py +228 -0
  76. python_snap7-3.2.1/tests/real_plc/test_acceptance.py +218 -0
  77. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_async_client.py +14 -0
  78. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_client.py +2 -2
  79. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_client_e2e.py +59 -62
  80. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_hypothesis.py +1 -2
  81. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_lean_regressions.py +19 -1
  82. python_snap7-3.2.1/tests/test_operation_hook.py +201 -0
  83. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_property.py +2 -2
  84. python_snap7-3.2.1/tests/test_real_plc_support.py +117 -0
  85. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_s7protocol.py +149 -69
  86. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_server.py +212 -15
  87. python_snap7-3.2.1/tox.ini +36 -0
  88. python_snap7-3.2.0/MANIFEST.in +0 -1
  89. {python_snap7-3.2.0 → python_snap7-3.2.1}/LICENSE +0 -0
  90. /python_snap7-3.2.0/snap7/py.typed → /python_snap7-3.2.1/doc/_static/.phony +0 -0
  91. {python_snap7-3.2.0 → python_snap7-3.2.1}/python_snap7.egg-info/dependency_links.txt +0 -0
  92. {python_snap7-3.2.0 → python_snap7-3.2.1}/python_snap7.egg-info/entry_points.txt +0 -0
  93. {python_snap7-3.2.0 → python_snap7-3.2.1}/python_snap7.egg-info/top_level.txt +0 -0
  94. {python_snap7-3.2.0 → python_snap7-3.2.1}/s7/__init__.py +0 -0
  95. {python_snap7-3.2.0 → python_snap7-3.2.1}/setup.cfg +0 -0
  96. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/__init__.py +0 -0
  97. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/cli.py +0 -0
  98. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/connection.py +0 -0
  99. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/datatypes.py +0 -0
  100. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/demo.py +0 -0
  101. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/discovery.py +0 -0
  102. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/error.py +0 -0
  103. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/log.py +0 -0
  104. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/logo.py +0 -0
  105. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/optimizer.py +0 -0
  106. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/partner.py +0 -0
  107. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/ppi.py +0 -0
  108. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/rate_limiter.py +0 -0
  109. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/server/__main__.py +0 -0
  110. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/szl.py +0 -0
  111. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/tags.py +0 -0
  112. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/type.py +0 -0
  113. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/util/__init__.py +0 -0
  114. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/util/db.py +0 -0
  115. {python_snap7-3.2.0 → python_snap7-3.2.1}/snap7/util/setters.py +0 -0
  116. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_api_surface.py +0 -0
  117. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_behavioral_compatibility.py +0 -0
  118. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_cli.py +0 -0
  119. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_conformance.py +0 -0
  120. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_connection.py +0 -0
  121. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_coverage_gaps.py +0 -0
  122. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_datatypes.py +0 -0
  123. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_demo.py +0 -0
  124. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_discovery.py +0 -0
  125. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_error.py +0 -0
  126. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_finalize.py +0 -0
  127. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_logging.py +0 -0
  128. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_logo_client.py +0 -0
  129. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_logo_reconnect_options.py +0 -0
  130. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_mainloop.py +0 -0
  131. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_multipacket.py +0 -0
  132. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_optimizer.py +0 -0
  133. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_partner.py +0 -0
  134. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_ppi.py +0 -0
  135. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_rate_limiter.py +0 -0
  136. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_reconnect.py +0 -0
  137. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_routing.py +0 -0
  138. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_server_cli.py +0 -0
  139. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_stress.py +0 -0
  140. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_tags.py +0 -0
  141. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_typed_access.py +0 -0
  142. {python_snap7-3.2.0 → python_snap7-3.2.1}/tests/test_util.py +0 -0
@@ -0,0 +1,373 @@
1
+ CHANGES
2
+ ========
3
+
4
+ 3.2.1
5
+ -----
6
+
7
+ Bug-fix and packaging release, with a few small additions.
8
+
9
+ ### Packaging
10
+
11
+ * Include the full test suite (`tests/__init__.py`, `tests/conftest.py`, PLC setup
12
+ files), examples, docs, and `CHANGES.md` in the source distribution (#912, #913).
13
+ * Remove leftover HarpoS7 test fixtures and transpiler from the S7CommPlus
14
+ split (#914).
15
+
16
+ ### New features
17
+
18
+ * Add an `on_operation` callback to the synchronous and asynchronous clients,
19
+ invoked after each PLC operation with its name, duration, and whether it
20
+ raised, plus an example Prometheus metrics exporter (#843, #901).
21
+ * Add a safe, Gherkin-based real-PLC acceptance program with restored scratch
22
+ writes and sanitized JSON/JUnit reports (#840, #892, #908).
23
+
24
+ ### Bug fixes
25
+
26
+ * Match the classic Snap7 upload wire layout, collect every upload fragment, and
27
+ reject malformed, truncated, or mismatched S7/USERDATA responses (#903).
28
+ * Use the PLC-driven request/response sequence for block download and match
29
+ classic S7 wire vectors for list-blocks-of-type, set clock, get block info,
30
+ and password requests (#904).
31
+ * Fix the return type annotations of `snap7.util.get_byte` and `get_word`, which
32
+ return `int`, not `bytes`/`bytearray` (#910).
33
+
34
+ 3.2.0
35
+ -----
36
+
37
+ Feature and robustness release for the classic S7 protocol implementation.
38
+
39
+ ### Packaging
40
+
41
+ * Move S7CommPlus support to the standalone
42
+ [`s7commplus`](https://github.com/gijzelaerr/s7commplus) package. The `s7`
43
+ import remains available as an alias for the classic `snap7` package.
44
+
45
+ ### New features
46
+
47
+ * Add configurable request rate limiting to synchronous and asynchronous
48
+ clients, including fixed-interval and token-bucket modes (#823).
49
+ * Add synchronous and asynchronous APIs for forcing I/O bits, cancelling
50
+ forces, and reading the PLC force table (#796, #800).
51
+ * Add synchronous and asynchronous session password set/clear APIs for
52
+ password-protected PLCs (#792, #799).
53
+ * Support LOGO reconnection, heartbeat, rate-limiting, and connection callback
54
+ options while preserving explicit TSAPs (#875).
55
+ * Add an experimental serial PPI client for S7-200 PLCs, including V-memory,
56
+ system-memory, I/O, counter, and timer access (#824).
57
+
58
+ ### Bug fixes
59
+
60
+ * Parse structured and flat SZL 0x0011 records correctly when reading order
61
+ codes and firmware versions from S7-1500 and classic PLCs (#783, #789).
62
+ * Dispatch server callbacks and queue protocol events for client requests
63
+ instead of reporting only the server start event (#853, #856).
64
+ * Validate classic S7 TPKT bounds and COTP Class 0 headers in synchronous and
65
+ asynchronous clients (#874).
66
+ * Reject incomplete reads and mismatched or missing read/write
67
+ acknowledgements (#874).
68
+ * Size read/write chunks in whole elements and preserve ctypes write
69
+ datatypes; correct BIT lengths and timer/counter index addressing (#874).
70
+ * Validate `write_multi_vars()` inputs consistently and preserve each item's
71
+ declared datatype (#855, #874).
72
+ * Echo the calling and called TSAP values in server connection confirmations,
73
+ and restart the receive deadline after each complete TPKT header (#893).
74
+ * Return S7 item errors for reads from unregistered server areas or addresses
75
+ outside registered memory instead of returning fabricated data (#896).
76
+
77
+ 3.1.2
78
+ -----
79
+
80
+ Corrective bug fix and robustness release replacing the yanked 3.1.1 release.
81
+
82
+ ### Corrections
83
+
84
+ * Withdraw the vulnerability and CWE characterizations published with 3.1.1.
85
+ Independent review found that those descriptions overstated or incorrectly
86
+ described the affected code paths.
87
+
88
+ ### Robustness fixes
89
+
90
+ * Bound the server to 64 simultaneous clients by default, enforce the existing
91
+ `MaxClients` parameter, and allow `max_clients` configuration.
92
+ * Validate block-download targets and declared sizes before allocating transfer
93
+ state, cap accumulated data at the declared size and registered area's
94
+ capacity, and clean up abandoned upload/download state on disconnect.
95
+ * Correct block-download address parsing so the requested DB number is used
96
+ instead of silently falling back to DB1.
97
+ * Bound COTP request reassembly to 1 MiB and apply one absolute deadline across
98
+ all fragments of a request.
99
+ * Apply COTP TPDU-size validation consistently to sync and async clients.
100
+ * Add regression tests for invalid PDU negotiation, TPDU-size validation,
101
+ connection limits, request reassembly, and block-download limits.
102
+
103
+ 3.1.1 (yanked)
104
+ ----------------
105
+
106
+ This release was yanked because its security descriptions were inaccurate and
107
+ some of its input-hardening changes were incomplete. Use 3.1.2 instead.
108
+
109
+ ### Robustness changes
110
+
111
+ * Validate COTP TPDU-size encodings in the synchronous client.
112
+ * Normalize implausibly small negotiated PDU lengths and ensure read/write
113
+ chunk sizes remain positive.
114
+ * Stop finalizing downloads into unregistered server memory areas. This did not
115
+ bound the download accumulator and was completed in 3.1.2.
116
+
117
+ ### Bug fixes
118
+
119
+ * Fix `connection_type` not applied in TSAP composition during
120
+ `connect()` (#766)
121
+ * Fix auto-reconnect not triggered on multi-block read path (#787)
122
+ * Support multi-byte string encodings (GBK, UTF-8) in `get_string`,
123
+ `set_string`, `get_fstring`, `set_fstring` (#788)
124
+ * Thread encoding parameter through `read_tag` / `write_tag` /
125
+ `read_tags` (#786)
126
+ * Server: reassemble COTP-fragmented requests; include TPDU size
127
+ parameter in Connection Confirm so clients don't fall back to the
128
+ 128-byte ISO 8073 default (#804)
129
+ * Server: fix `INT` and `DINT` word lengths returning wrong byte count
130
+ in read requests (#804)
131
+
132
+ ### Thanks
133
+
134
+ * [@b1163646804](https://github.com/b1163646804) — multi-byte encoding
135
+ support and testing (#788)
136
+ * [@domelg](https://github.com/domelg) — server COTP fragmentation and
137
+ INT/DINT byte count bug reports (#804)
138
+
139
+ 3.1.0
140
+ -----
141
+
142
+ Feature and bug fix release for the pure Python S7 communication library.
143
+
144
+ ### New features
145
+
146
+ * **AsyncClient** for `asyncio` support (#593)
147
+ * **Unified Tag API**: `client.read_tag("DB1.DBD0:REAL")` with PLC4X /
148
+ Siemens STEP7 syntax (#697)
149
+ * **Dual-dialect tag parsing**: PLC4X and nodeS7 tag formats with
150
+ auto-detection (#701)
151
+ * **Multi-variable read optimizer** with parallel dispatch (experimental, #641)
152
+ * **S7 routing** for multi-subnet PLC access (experimental, #639)
153
+ * **Heartbeat monitoring** and auto-reconnect with exponential backoff (#635)
154
+ * **Structured logging** with PLC connection context (`snap7.log`, #688)
155
+ * **PROFINET DCP** network discovery (#634)
156
+ * **CLI tools** for PLC interaction (`pip install "python-snap7[cli]"`, #631)
157
+ * **Demo server** exposing real host metrics (#704)
158
+ * Typed DB access methods (`db_read_bool`, `db_read_int`, etc., #632)
159
+ * Symbolic addressing — read/write by tag name (experimental, #638)
160
+ * Diagnostic buffer reading (#690)
161
+ * Array read/write helpers (`db_read_array`, `db_write_array`, #693)
162
+ * Missing data type setters: `set_lint`, `set_ulint`, `set_ltime`, `set_ltod`, `set_ldt` (#693)
163
+ * Property-based testing with Hypothesis (#636)
164
+
165
+ ### Bug fixes
166
+
167
+ * Fix `AttributeError` from `__del__` during interpreter shutdown (#707)
168
+ * Fix server SZL 0x001C response to match real PLC format (#694)
169
+ * Fix `connection_type` in TSAP composition during connect (#766)
170
+ * Accept `memoryview` in setter and getter type annotations (#647)
171
+ * Zero-pad milliseconds in `get_time` (#716)
172
+ * Fix PI service PDU format for PLC control commands (#743)
173
+ * Fix `get_cpu_info` and `S7SZL.__str__` (#692)
174
+ * Fix partner S7 Communication Setup and bsend/brecv PDU format (#669)
175
+ * Fix `get_dtl` microsecond parsing (4-byte nanosecond field)
176
+ * Fix `set_date` unsigned short for day count
177
+ * Fix `set_tod` float precision loss
178
+ * Validate BMP range in `set_wstring`
179
+ * Fix async `get_cpu_info` SZL offsets (#702)
180
+ * Fix demo primary-IP guess with VPN/tunnel interfaces (#708)
181
+ * Fix mypy errors in server SZL list (#695)
182
+ * Robustness: 210+ S7 error codes, auto PDU splitting, stale packet retry (#580)
183
+
184
+ ### Improvements
185
+
186
+ * Set `TCP_NODELAY` and `SO_KEEPALIVE` on all sockets (#677)
187
+ * Export `get_ulint`, `get_lint`, `get_date_time_object` from `snap7.util` (#652)
188
+ * Documentation restructured: API Reference + Internals sections
189
+
190
+ ### Thanks
191
+
192
+ * [@hs2bws-hash](https://github.com/hs2bws-hash) — extensive real PLC testing of Partner BSend/BRecv (#668)
193
+ * [@QuakeString](https://github.com/QuakeString) — read optimizer inspiration via python-snap7-optimized fork
194
+
195
+ 3.0.0
196
+ -----
197
+
198
+ Major release: python-snap7 is now a pure Python S7 communication library.
199
+ This version completely breaks with the previous approach of wrapping the C snap7
200
+ shared library. The entire S7 protocol stack is now implemented in pure Python,
201
+ greatly improving portability and making it easier to install and extend.
202
+
203
+ * **Breaking**: The C snap7 library is no longer required or used
204
+ * Complete rewrite of the S7 protocol stack in pure Python
205
+ * Native Python implementation of TPKT (RFC 1006) and COTP (ISO 8073) layers
206
+ * Native S7 protocol PDU encoding/decoding
207
+ * Pure Python server implementation for testing and simulation
208
+ * No platform-specific binary dependencies — works on any platform that runs Python
209
+ * Improved error handling and connection management
210
+ * Full type annotations with mypy strict mode
211
+ * CLI interface for running an S7 server emulator (`pip install "python-snap7[cli]"`)
212
+
213
+ If you experience issues with 3.0, please report them on the
214
+ [issue tracker](https://github.com/gijzelaerr/python-snap7/issues) with a clear
215
+ description and the version you are using. As a workaround, pin to the last
216
+ pre-3.0 release:
217
+
218
+ $ pip install "python-snap7<3"
219
+
220
+ ### Thanks
221
+
222
+ Special thanks to the following people for testing, reporting issues, and providing
223
+ feedback during the 3.0 development:
224
+
225
+ * [@lupaulus](https://github.com/lupaulus) — extensive testing and bug reports
226
+ * [@spreeker](https://github.com/spreeker) — testing and feedback
227
+ * [@nikteliy](https://github.com/nikteliy) — review and feedback on the rewrite
228
+ * [@amorelettronico](https://github.com/amorelettronico) — testing
229
+ * [@razour08](https://github.com/razour08) — testing
230
+ * [@core-engineering](https://github.com/core-engineering) — bug reports (#553)
231
+ * [@AndreasScharf](https://github.com/AndreasScharf) — bug reports (#572)
232
+ * [@Robatronic](https://github.com/Robatronic) — bug reports (#574)
233
+ * [@hirotasoshu](https://github.com/hirotasoshu) — feedback (#545)
234
+ * [@PoitrasJ](https://github.com/PoitrasJ) — bug reports (#479)
235
+
236
+ 1.2
237
+ ---
238
+
239
+ * fix wheel tag for linux x86_64 by @nikteliy in https://github.com/gijzelaerr/python-snap7/pull/297
240
+ * Fixed typo area doesn't exist areas does by @Ofloo in https://github.com/gijzelaerr/python-snap7/pull/306
241
+ * add get_time and set_time in util by @Yingliangzhe in https://github.com/gijzelaerr/python-snap7/pull/308
242
+ * modification of TIME data type by @Yingliangzhe in https://github.com/gijzelaerr/python-snap7/pull/311
243
+ * added DATE_AND_TIME Value as Datetime object by @zsisamci in https://github.com/gijzelaerr/python-snap7/pull/312
244
+ * #273 by @nikteliy in https://github.com/gijzelaerr/python-snap7/pull/321
245
+ * Add byte type parsing to DB_Row API + set parsing case insensitive by @LoicGRENON in https://github.com/gijzelaerr/python-snap7/pull/315
246
+ * added missing types in WordLen by @zsisamci in https://github.com/gijzelaerr/python-snap7/pull/326
247
+ * Add support for read/write unsigned value from bytearray by @LoicGRENON in https://github.com/gijzelaerr/python-snap7/pull/316
248
+ * fixing ip string paramters to c function by @zsisamci in https://github.com/gijzelaerr/python-snap7/pull/329
249
+ * Add py.typed marker file by @mthuurne in https://github.com/gijzelaerr/python-snap7/pull/342
250
+ * require correct package name, fixes issue #344 by @gijzelaerr in https://github.com/gijzelaerr/python-snap7/pull/345
251
+ * Fix warnings by @nikteliy in https://github.com/gijzelaerr/python-snap7/pull/350
252
+ * Update license identifier by @Shortfinga in https://github.com/gijzelaerr/python-snap7/pull/349
253
+ * Update client db_write docs by @pwablito in https://github.com/gijzelaerr/python-snap7/pull/352
254
+ * Fix db_offset calculation error by @lubbbert in https://github.com/gijzelaerr/python-snap7/pull/351
255
+ * fix #355 by @swamper123 in https://github.com/gijzelaerr/python-snap7/pull/359
256
+ * fix #272 by @swamper123 in https://github.com/gijzelaerr/python-snap7/pull/360
257
+ * fix get_time for small values by @swamper123 in https://github.com/gijzelaerr/python-snap7/pull/358
258
+ * add more getter methods for utils by @swamper123 in https://github.com/gijzelaerr/python-snap7/pull/357
259
+ * Prepare for 1.2 by @gijzelaerr in https://github.com/gijzelaerr/python-snap7/pull/364
260
+
261
+ ### New Contributors
262
+
263
+ * @Ofloo made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/306
264
+ * @zsisamci made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/312
265
+ * @LoicGRENON made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/315
266
+ * @mthuurne made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/342
267
+ * @Shortfinga made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/349
268
+ * @pwablito made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/352
269
+ * @lubbbert made their first contribution in https://github.com/gijzelaerr/python-snap7/pull/351
270
+
271
+ **Full Changelog**: https://github.com/gijzelaerr/python-snap7/compare/1.1...1.2
272
+
273
+ 1.1
274
+ ---
275
+
276
+ * Make a binary wheel for all platforms (#232)
277
+ * Improve doc strings of all functions (#242)
278
+
279
+ Special thanks for this release to
280
+ * Fabian Beitler
281
+ * Nikteliy
282
+ * Lautaro Nahuel Dapino
283
+
284
+ 1.0
285
+ ---
286
+
287
+ * Drop python 2 support (#214)
288
+ * Feature request: ReadSZL() (#196)
289
+ * Keep argument format across the functions (#193)
290
+ * Drop Python2 Tests (#167)
291
+ * Support for S5TIME (#163)
292
+ * Add type annotations (#157)
293
+ * client.full_upload() return bytearray size 65536 (#127)
294
+ * Some client tests segfault on Linux (#26)
295
+ * Not all functions are implemented yet (#25)
296
+
297
+ special thanks to [Fabian Beitler](https://github.com/swamper123) and
298
+ [Nikteliy](https://github.com/nikteliy>) for their contributions to the 1.0 release!
299
+
300
+
301
+
302
+
303
+ 0.11
304
+ ----
305
+
306
+ * Update read_multi.py (#132)
307
+ * Added fixes to snap7/client.py read_area function to allow for Counter and Timer Reads (#121)
308
+ * Post to a public docker repository? (#119)
309
+ * Implementation of Cli_SetDateTime, Cli_GetDateTime enhancement (#114)
310
+
311
+
312
+ 0.10
313
+ ----
314
+
315
+ * Fix OSX travis build #99
316
+ * util.get_int() broken #101
317
+ * Compatibility issue with Python3 #109
318
+ * Logo 8 improvements bug #105
319
+
320
+
321
+ 0.7
322
+ ---
323
+
324
+ * util.get_int() broken (#65, #71)
325
+ * fix Add files via upload bug (#59)
326
+
327
+ Special thanks to Pelle van der Heide for solving issues
328
+
329
+
330
+ 0.6
331
+ ---
332
+
333
+ * Add __del__ to client, server and partner (#69)
334
+ * Add files via upload (#59)
335
+
336
+ Special thanks to xybsoft for solving issues
337
+
338
+ 0.5
339
+ ---
340
+
341
+ * adding some missing functions
342
+ * fixing Python3 support (issue #43)
343
+ * improving the documentation
344
+
345
+ 0.4
346
+ ---
347
+
348
+ More functions added:
349
+
350
+ * client.plc_stop
351
+ * client.plc_cold_start
352
+ * client.plc_hot_start
353
+ * client.read_multi_vars
354
+
355
+ 0.2.1
356
+ -----
357
+
358
+ Small fix, README.rst was not included in sdist
359
+
360
+
361
+ 0.2
362
+ ---
363
+
364
+ - Add support for Windows
365
+ - Add functions added in Snap7 1.1.0
366
+ - Add missing client functions
367
+ - fix some partner functions
368
+ - simplified API
369
+
370
+ 0.1
371
+ ---
372
+
373
+ - Initial release.
@@ -0,0 +1,9 @@
1
+ include README.rst
2
+ include CHANGES.md
3
+ include LICENSE
4
+ include tox.ini
5
+ graft tests
6
+ prune tests/fixtures
7
+ graft example
8
+ graft doc
9
+ global-exclude *.py[cod] __pycache__
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-snap7
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Pure Python S7 communication library for Siemens PLCs
5
5
  Author-email: Gijs Molenaar <gijsmolenaar@gmail.com>
6
6
  License-Expression: MIT
@@ -24,6 +24,7 @@ License-File: LICENSE
24
24
  Provides-Extra: test
25
25
  Requires-Dist: pytest; extra == "test"
26
26
  Requires-Dist: pytest-asyncio; extra == "test"
27
+ Requires-Dist: pytest-bdd<9,>=8.1; extra == "test"
27
28
  Requires-Dist: pytest-cov; extra == "test"
28
29
  Requires-Dist: pytest-html; extra == "test"
29
30
  Requires-Dist: hypothesis; extra == "test"
@@ -101,3 +102,6 @@ Documentation
101
102
 
102
103
  Read the full documentation at
103
104
  `python-snap7.readthedocs.io <https://python-snap7.readthedocs.io/en/latest/>`_.
105
+
106
+ The safe volunteer hardware-test procedure is in
107
+ `Real-PLC acceptance testing <doc/real-plc-testing.rst>`_.
@@ -49,3 +49,6 @@ Documentation
49
49
 
50
50
  Read the full documentation at
51
51
  `python-snap7.readthedocs.io <https://python-snap7.readthedocs.io/en/latest/>`_.
52
+
53
+ The safe volunteer hardware-test procedure is in
54
+ `Real-PLC acceptance testing <doc/real-plc-testing.rst>`_.
@@ -0,0 +1,9 @@
1
+ Shared Client Internals
2
+ =======================
3
+
4
+ Pure-computation and compatibility methods shared by ``Client`` and
5
+ ``AsyncClient``. Applications normally access these methods through one of the
6
+ concrete clients.
7
+
8
+ .. automodule:: snap7.client_base
9
+ :members:
@@ -0,0 +1,45 @@
1
+ Client
2
+ ======
3
+
4
+ The ``s7`` package implements the classic S7 protocol for S7-300/400 PLCs and
5
+ PUT/GET access on S7-1200/1500.
6
+
7
+ Use ``Client`` for synchronous applications::
8
+
9
+ from s7 import Client
10
+
11
+ with Client() as client:
12
+ client.connect("192.168.1.10", 0, 1)
13
+ data = client.db_read(1, 0, 4)
14
+
15
+ Use ``AsyncClient`` when the surrounding application uses ``asyncio``::
16
+
17
+ import asyncio
18
+ from s7 import AsyncClient
19
+
20
+ async def main():
21
+ async with AsyncClient() as client:
22
+ await client.connect("192.168.1.10", 0, 1)
23
+ data = await client.db_read(1, 0, 4)
24
+
25
+ asyncio.run(main())
26
+
27
+ Both clients expose the same main PLC operations, including area and DB
28
+ access, block transfer, CPU information and control, clock access, force
29
+ operations, and session passwords. Methods that perform I/O are coroutines on
30
+ ``AsyncClient``. See :doc:`../advanced` for the less common operations.
31
+
32
+ s7.Client
33
+ ---------
34
+
35
+ .. automodule:: snap7.client
36
+ :members:
37
+ :inherited-members:
38
+
39
+ s7.AsyncClient
40
+ --------------
41
+
42
+ .. automodule:: snap7.async_client
43
+ :members:
44
+ :inherited-members:
45
+ :exclude-members: AsyncISOTCPConnection
@@ -0,0 +1,8 @@
1
+ Connection
2
+ ==========
3
+
4
+ The connection module implements the ISO on TCP transport layer (TPKT/COTP)
5
+ used for S7 communication.
6
+
7
+ .. automodule:: snap7.connection
8
+ :members:
@@ -0,0 +1,7 @@
1
+ Data Types
2
+ ==========
3
+
4
+ The datatypes module provides S7 data type definitions and address encoding.
5
+
6
+ .. automodule:: snap7.datatypes
7
+ :members:
@@ -0,0 +1,9 @@
1
+ Demo Server
2
+ ===========
3
+
4
+ Implementation of the optional live host-metrics demo used by ``s7 demo``.
5
+ Install ``python-snap7[demo]`` before running it. This module is intended for
6
+ examples and integration testing, not production monitoring.
7
+
8
+ .. automodule:: snap7.demo
9
+ :members:
@@ -0,0 +1,7 @@
1
+ Discovery
2
+ =========
3
+
4
+ .. automodule:: snap7.discovery
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
@@ -0,0 +1,5 @@
1
+ Errors
2
+ ======
3
+
4
+ .. automodule:: snap7.error
5
+ :members:
@@ -0,0 +1,33 @@
1
+ Logging
2
+ =======
3
+
4
+ Structured logging with PLC connection context for multi-PLC environments.
5
+
6
+ The :class:`~snap7.log.PLCLoggerAdapter` automatically injects PLC host,
7
+ rack, and slot into every log message:
8
+
9
+ .. code-block:: python
10
+
11
+ import logging
12
+ logging.basicConfig(level=logging.DEBUG)
13
+
14
+ from s7 import Client
15
+ client = Client()
16
+ client.connect("192.168.1.10", 0, 1)
17
+ # Logs: [192.168.1.10 R0/S1] Connected to 192.168.1.10:102 ...
18
+
19
+ For JSON output (ELK, Datadog, Loki):
20
+
21
+ .. code-block:: python
22
+
23
+ from s7.log import JSONFormatter
24
+
25
+ handler = logging.StreamHandler()
26
+ handler.setFormatter(JSONFormatter())
27
+ logging.getLogger("snap7").addHandler(handler)
28
+
29
+ API reference
30
+ -------------
31
+
32
+ .. automodule:: snap7.log
33
+ :members:
@@ -0,0 +1,5 @@
1
+ Logo
2
+ ====
3
+
4
+ .. autoclass:: snap7.logo.Logo
5
+ :members:
@@ -0,0 +1,79 @@
1
+ Optimizer
2
+ =========
3
+
4
+ .. warning::
5
+
6
+ The read optimizer is **experimental** and its API may change in future
7
+ versions. Disable it with ``client.use_optimizer = False`` if you
8
+ encounter issues.
9
+
10
+ The multi-variable read optimizer merges adjacent or overlapping read requests
11
+ and packs them into minimal PDU-sized S7 exchanges. This significantly reduces
12
+ the number of round-trips when reading many scattered variables.
13
+
14
+ How it works
15
+ ------------
16
+
17
+ The optimizer uses a three-stage pipeline inspired by
18
+ `nodeS7 <https://github.com/plcpeople/nodeS7>`_:
19
+
20
+ 1. **Sort** — items are sorted by area, DB number, and byte offset so that
21
+ adjacent reads end up next to each other.
22
+
23
+ 2. **Merge** — sorted items in the same area/DB with a small gap between them
24
+ (configurable via ``multi_read_max_gap``) are merged into contiguous read
25
+ blocks. This avoids issuing many small reads when a single larger read
26
+ covers them all.
27
+
28
+ 3. **Packetize** — merged blocks are packed into PDU-sized packets, respecting
29
+ both the request and reply size budgets of the negotiated PDU length.
30
+
31
+ Parallel dispatch
32
+ -----------------
33
+
34
+ When there are multiple packets to send, the optimizer can fire them
35
+ back-to-back on the same TCP connection and collect responses by sequence
36
+ number (pipelining). This avoids paying a full round-trip per packet.
37
+
38
+ The number of in-flight packets is controlled by ``max_parallel``, which is
39
+ auto-tuned based on the negotiated PDU size after connecting:
40
+
41
+ .. list-table::
42
+ :header-rows: 1
43
+
44
+ * - PDU size
45
+ - max_parallel
46
+ * - >= 960
47
+ - 8
48
+ * - >= 480
49
+ - 4
50
+ * - >= 240
51
+ - 2
52
+ * - < 240
53
+ - 1 (sequential)
54
+
55
+ You can override it manually::
56
+
57
+ client.max_parallel = 2 # limit to 2 in-flight packets
58
+
59
+ Configuration
60
+ -------------
61
+
62
+ .. code-block:: python
63
+
64
+ client.use_optimizer = False # disable optimizer entirely
65
+ client.multi_read_max_gap = 10 # merge reads up to 10 bytes apart (default 5)
66
+ client.max_parallel = 1 # disable parallel dispatch (sequential only)
67
+
68
+ Plan caching
69
+ ------------
70
+
71
+ The optimizer caches the merge/packetize plan for repeated calls with the same
72
+ item layout. If you always read the same set of variables in a loop (a common
73
+ pattern in PLC polling), the planning overhead is paid only on the first call.
74
+
75
+ API reference
76
+ -------------
77
+
78
+ .. automodule:: snap7.optimizer
79
+ :members:
@@ -0,0 +1,24 @@
1
+ Partner
2
+ =======
3
+
4
+ The ``Partner`` class implements S7 peer-to-peer communication for
5
+ bidirectional data exchange using BSend/BRecv. Both partners have equal
6
+ rights and can send data asynchronously. Partner is part of the legacy
7
+ ``s7`` package.
8
+
9
+ .. code:: python
10
+
11
+ from s7 import Partner
12
+
13
+ partner = Partner(active=True)
14
+ partner.port = 102
15
+ partner.r_id = 0x00000001
16
+ partner.start_to("0.0.0.0", "192.168.1.10", 0x1300, 0x1301)
17
+ partner.set_send_data(b"Hello")
18
+ partner.b_send()
19
+ partner.stop()
20
+
21
+ ----
22
+
23
+ .. automodule:: snap7.partner
24
+ :members:
@@ -0,0 +1,10 @@
1
+ PPI
2
+ ===
3
+
4
+ Serial PPI transport and client support for S7-200 PLCs. Install the optional
5
+ dependency with ``pip install "python-snap7[ppi]"`` and see :doc:`../ppi` for
6
+ setup, area semantics, and current limitations.
7
+
8
+ .. automodule:: snap7.ppi
9
+ :members:
10
+ :show-inheritance:
@@ -0,0 +1,10 @@
1
+ Rate Limiter
2
+ ============
3
+
4
+ The synchronous and asynchronous clients create a limiter from their
5
+ ``max_requests_per_second`` and ``rate_limit_*`` constructor arguments. Most
6
+ applications should configure the client instead of constructing this class
7
+ directly.
8
+
9
+ .. automodule:: snap7.rate_limiter
10
+ :members: