Skip to content

Split S7CommPlus into standalone s7commplus package, remove unified s7 client #769

Description

@gijzelaerr

Summary

The current s7/ package tries to unify legacy S7 (snap7) and S7CommPlus behind a single Client that auto-negotiates the protocol. In practice the two protocols differ too much — different capabilities (browse is S7CommPlus-only), different connection requirements (TLS, SessionKey handshake), and different failure modes. The silent fallback from S7CommPlus to legacy creates confusing errors (#760, #710) and makes it hard for users to understand what's happening.

Plan

  1. Create a new top-level s7commplus/ package containing the S7CommPlus-specific code currently in s7/:

    • _s7commplus_client.pys7commplus/client.py
    • _s7commplus_async_client.pys7commplus/async_client.py
    • _s7commplus_server.pys7commplus/server.py
    • s7/connection.pys7commplus/connection.py
    • s7/protocol.pys7commplus/protocol.py
    • s7/codec.py, s7/vlq.py, s7/legitimation.pys7commplus/
  2. Keep snap7/ unchanged — it remains the legacy S7 package for S7-300/400 and PUT/GET on S7-1200/1500.

  3. Shared code (TPKT/COTP transport in snap7/connection.py) stays in snap7s7commplus imports from it.

  4. Remove the unified s7/ package — no more s7/client.py with auto-negotiation and silent fallback. Users explicitly choose snap7.Client or s7commplus.Client.

  5. Update examples, docs, tests, and CLAUDE.md to reflect the new structure.

Motivation

  • Users should explicitly choose their protocol rather than getting silent fallback behavior
  • The two protocols have fundamentally different capabilities and requirements
  • Cleaner API surface — no more "browse() requires S7CommPlus connection" errors after silent fallback
  • Easier to document and maintain each protocol independently

Timing

Do this after all current open PRs are merged (#761, #763, #764, #768) since they touch s7/client.py and s7/connection.py heavily.

Breaking change

This removes the s7 package entirely. Users importing from s7 will need to switch to either snap7 or s7commplus. This should be part of a major or minor version bump with migration notes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions