commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Clarify what's a breaking change in commitizen

Open Lee-W opened this issue 7 months ago • 4 comments

Description

https://github.com/commitizen-tools/commitizen/issues/1435#issuecomment-2891305051

Possible Solution

No response

Additional context

No response

Additional context

No response

Lee-W avatar May 22 '25 04:05 Lee-W

Relevant commit: 94c02b3

bearomorphism avatar May 22 '25 08:05 bearomorphism

I'll probably do something like the following in defaults.py

# mymodule.py

import warnings

# ✅ Non-deprecated export
NEW_CONSTANT = "new value"

# ⚠️ Deprecated export (will warn on access)
_OLD_CONSTANT = "old value"

def __getattr__(name):
    if name == "OLD_CONSTANT":
        warnings.warn(
            "OLD_CONSTANT is deprecated and will be removed in a future version. Use NEW_CONSTANT instead.",
            category=DeprecationWarning,
            stacklevel=2,
        )
        return _OLD_CONSTANT
    raise AttributeError(f"module {__name__} has no attribute {name}")

bearomorphism avatar May 22 '25 08:05 bearomorphism

I'll probably do something like the following in defaults.py

mymodule.py

import warnings

✅ Non-deprecated export

NEW_CONSTANT = "new value"

⚠️ Deprecated export (will warn on access)

_OLD_CONSTANT = "old value"

def getattr(name): if name == "OLD_CONSTANT": warnings.warn( "OLD_CONSTANT is deprecated and will be removed in a future version. Use NEW_CONSTANT instead.", category=DeprecationWarning, stacklevel=2, ) return _OLD_CONSTANT raise AttributeError(f"module {name} has no attribute {name}")

Yep, PEP562 is definitely something we should use 🙂

Lee-W avatar May 23 '25 03:05 Lee-W

I think the change in the following aspect should be viewed as a breaking changes.

  1. How the cz command is used.
  2. config used to be there, but removed
  3. Change of BaseCommitizen, VersionProvider, VersionProtocol publice interface

Lee-W avatar Aug 24 '25 11:08 Lee-W