Skip to content

Christmas-Wish: Backwards Compatibility #2832

@Linafri

Description

@Linafri

Hello,

I see that alone this year there were many breaking changes in Minor versions (X in 3.X.*).
And in my view, this could have been handled better: e.g. the naming of slave vs. device:
Why not allow both notions until the next Major version?

def __init__(self, **kwargs):
    self.slave = kwargs.pop('slave', kwargs.pop('unit', 1))
    if 'unit' in kwargs:
        warnings.warn("'unit' is deprecated, use 'slave'", DeprecationWarning)

Next example:
In version 3.8.0, many constructors (like ModbusTcpClient) stopped accepting positional arguments.
ModbusTcpClient("127.0.0.1", 502) suddenly threw a TypeError. You were forced to write host="127.0.0.1", port=502.

Better approach: Graceful Degradation. Use *args to capture positional arguments, mapped them to the correct attributes, and issued a FutureWarning.

Or:
The way SSL/TLS is handled was completely restructured, moving away from simple parameters (certfile, keyfile) to a more complex sslcontext approach. Also here, backwards-compatibility would have been possible until next major version.
and/or a helper method that automatically constructs the new SSLContext if the old parameters were detected. This would allow the underlying engine to be modern while keeping the entry point user-friendly for legacy users.

Or:
Pymodbus frequently reorganizes its internal folder structure (e.g., moving things from pymodbus.client.sync to pymodbus.client).

The problem is: it is not always possible to use a specific pymodbus-version for the own Software.

May I ask you to consider such backwards-compatibility?

Greetings,
Hendrik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions