Add unified s7 package with protocol auto-discovery#657
Closed
gijzelaerr wants to merge 4 commits intomasterfrom
Closed
Add unified s7 package with protocol auto-discovery#657gijzelaerr wants to merge 4 commits intomasterfrom
gijzelaerr wants to merge 4 commits intomasterfrom
Conversation
683882e to
49a3474
Compare
Introduces a new top-level `s7` package that provides a single Client, AsyncClient, and Server that automatically select the best protocol (S7CommPlus or legacy S7) for the target PLC. Users no longer need to choose between snap7.Client and snap7.s7commplus.Client. - `from s7 import Client` — unified entry point - connect() tries S7CommPlus first, falls back to legacy transparently - Full legacy API (~100 methods) available via __getattr__ delegation - db_read/db_write route through S7CommPlus when available - Unified Server wraps both legacy and S7CommPlus servers - 26 unit tests covering auto-discovery, fallback, and delegation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
49a3474 to
5a3d4e1
Compare
Add complete V2 and V3 support including TLS 1.3 encryption, per-request IntegrityId counters, session setup handshake, and password authentication (legitimation). Extend server emulator to support V2/V3 for integration testing without real hardware. - Fix V3 handling in connection.py (unified V2/V3 code path) - Add TLS, session setup, and auth to async client - Add legitimation and IntegrityId emulation to server - Add 21 TLS integration tests (sync + async, V2 + V3, auth) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 60be285.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
s7package providing a unifiedClient,AsyncClient, andServerwith automatic protocol selection (S7CommPlus vs legacy S7)snap7.Clientandsnap7.s7commplus.Client—from s7 import Clienthandles everything__getattr__delegation,db_read/db_writeroute through S7CommPlus when availableHow it works
connect()keeps the legacy positional args for backward compatuse_tls,password) available as keyword-only argsprotocol=Protocol.LEGACYto skip S7CommPlus entirelyTest plan
uv run pytest tests/test_s7_unified.py— 26 new unit tests passuv run pytest tests/— all existing tests unaffecteduv run mypy snap7 s7 tests— cleanuv run ruff check snap7 s7 tests— cleanfrom s7 import Client; c = Client(); c.connect(host, rack, slot)against real PLC🤖 Generated with Claude Code