API checks¤
find_breaking_changes ¤
Find breaking changes between two versions of the same API.
The function will iterate recursively on all objects and yield breaking changes with detailed information.
Parameters:
-
old_obj
¤Object | Alias
) –The old version of an object.
-
new_obj
¤Object | Alias
) –The new version of an object.
Yields:
-
Breakage
–Breaking changes.
Examples:
>>> import sys, griffe
>>> new = griffe.load("pkg")
>>> old = griffe.load_git("pkg", "1.2.3")
>>> for breakage in griffe.find_breaking_changes(old, new)
... print(breakage.explain(style=style), file=sys.stderr)
ExplanationStyle ¤
flowchart TD
griffe.ExplanationStyle[ExplanationStyle]
click griffe.ExplanationStyle href "" "griffe.ExplanationStyle"
Enumeration of the possible styles for explanations.
Attributes:
Breakage ¤
Breakages can explain what broke from a version to another.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
BreakageKind ¤
flowchart TD
griffe.BreakageKind[BreakageKind]
click griffe.BreakageKind href "" "griffe.BreakageKind"
Enumeration of the possible API breakages.
Attributes:
-
ATTRIBUTE_CHANGED_TYPE
(str
) –Attribute types are incompatible
-
ATTRIBUTE_CHANGED_VALUE
(str
) –Attribute value was changed
-
CLASS_REMOVED_BASE
(str
) –Base class was removed
-
OBJECT_CHANGED_KIND
(str
) –Public object points to a different kind of object
-
OBJECT_REMOVED
(str
) –Public object was removed
-
PARAMETER_ADDED_REQUIRED
(str
) –Parameter was added as required
-
PARAMETER_CHANGED_DEFAULT
(str
) –Parameter default was changed
-
PARAMETER_CHANGED_KIND
(str
) –Parameter kind was changed
-
PARAMETER_CHANGED_REQUIRED
(str
) –Parameter is now required
-
PARAMETER_MOVED
(str
) –Positional parameter was moved
-
PARAMETER_REMOVED
(str
) –Parameter was removed
-
RETURN_CHANGED_TYPE
(str
) –Return types are incompatible
ATTRIBUTE_CHANGED_TYPE class-attribute
instance-attribute
¤
ATTRIBUTE_CHANGED_TYPE: str = (
"Attribute types are incompatible"
)
Attribute types are incompatible
ATTRIBUTE_CHANGED_VALUE class-attribute
instance-attribute
¤
ATTRIBUTE_CHANGED_VALUE: str = "Attribute value was changed"
Attribute value was changed
CLASS_REMOVED_BASE class-attribute
instance-attribute
¤
CLASS_REMOVED_BASE: str = 'Base class was removed'
Base class was removed
OBJECT_CHANGED_KIND class-attribute
instance-attribute
¤
OBJECT_CHANGED_KIND: str = (
"Public object points to a different kind of object"
)
Public object points to a different kind of object
OBJECT_REMOVED class-attribute
instance-attribute
¤
OBJECT_REMOVED: str = 'Public object was removed'
Public object was removed
PARAMETER_ADDED_REQUIRED class-attribute
instance-attribute
¤
PARAMETER_ADDED_REQUIRED: str = (
"Parameter was added as required"
)
Parameter was added as required
PARAMETER_CHANGED_DEFAULT class-attribute
instance-attribute
¤
PARAMETER_CHANGED_DEFAULT: str = (
"Parameter default was changed"
)
Parameter default was changed
PARAMETER_CHANGED_KIND class-attribute
instance-attribute
¤
PARAMETER_CHANGED_KIND: str = 'Parameter kind was changed'
Parameter kind was changed
PARAMETER_CHANGED_REQUIRED class-attribute
instance-attribute
¤
PARAMETER_CHANGED_REQUIRED: str = (
"Parameter is now required"
)
Parameter is now required
PARAMETER_MOVED class-attribute
instance-attribute
¤
PARAMETER_MOVED: str = 'Positional parameter was moved'
Positional parameter was moved
AttributeChangedTypeBreakage ¤
flowchart TD
griffe.AttributeChangedTypeBreakage[AttributeChangedTypeBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.AttributeChangedTypeBreakage
click griffe.AttributeChangedTypeBreakage href "" "griffe.AttributeChangedTypeBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for attributes whose type changed.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = ATTRIBUTE_CHANGED_TYPE
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
AttributeChangedValueBreakage ¤
flowchart TD
griffe.AttributeChangedValueBreakage[AttributeChangedValueBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.AttributeChangedValueBreakage
click griffe.AttributeChangedValueBreakage href "" "griffe.AttributeChangedValueBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for attributes whose value changed.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = ATTRIBUTE_CHANGED_VALUE
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ClassRemovedBaseBreakage ¤
flowchart TD
griffe.ClassRemovedBaseBreakage[ClassRemovedBaseBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ClassRemovedBaseBreakage
click griffe.ClassRemovedBaseBreakage href "" "griffe.ClassRemovedBaseBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for removed base classes.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = CLASS_REMOVED_BASE
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ObjectChangedKindBreakage ¤
flowchart TD
griffe.ObjectChangedKindBreakage[ObjectChangedKindBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ObjectChangedKindBreakage
click griffe.ObjectChangedKindBreakage href "" "griffe.ObjectChangedKindBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for objects whose kind changed.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = OBJECT_CHANGED_KIND
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ObjectRemovedBreakage ¤
flowchart TD
griffe.ObjectRemovedBreakage[ObjectRemovedBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ObjectRemovedBreakage
click griffe.ObjectRemovedBreakage href "" "griffe.ObjectRemovedBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for removed objects.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterAddedRequiredBreakage ¤
flowchart TD
griffe.ParameterAddedRequiredBreakage[ParameterAddedRequiredBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterAddedRequiredBreakage
click griffe.ParameterAddedRequiredBreakage href "" "griffe.ParameterAddedRequiredBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for new parameters added as required.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = PARAMETER_ADDED_REQUIRED
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterChangedDefaultBreakage ¤
flowchart TD
griffe.ParameterChangedDefaultBreakage[ParameterChangedDefaultBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterChangedDefaultBreakage
click griffe.ParameterChangedDefaultBreakage href "" "griffe.ParameterChangedDefaultBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for parameters whose default value changed.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterChangedKindBreakage ¤
flowchart TD
griffe.ParameterChangedKindBreakage[ParameterChangedKindBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterChangedKindBreakage
click griffe.ParameterChangedKindBreakage href "" "griffe.ParameterChangedKindBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for parameters whose kind changed.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = PARAMETER_CHANGED_KIND
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterChangedRequiredBreakage ¤
flowchart TD
griffe.ParameterChangedRequiredBreakage[ParameterChangedRequiredBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterChangedRequiredBreakage
click griffe.ParameterChangedRequiredBreakage href "" "griffe.ParameterChangedRequiredBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for parameters which became required.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterMovedBreakage ¤
flowchart TD
griffe.ParameterMovedBreakage[ParameterMovedBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterMovedBreakage
click griffe.ParameterMovedBreakage href "" "griffe.ParameterMovedBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for moved parameters.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = PARAMETER_MOVED
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ParameterRemovedBreakage ¤
flowchart TD
griffe.ParameterRemovedBreakage[ParameterRemovedBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ParameterRemovedBreakage
click griffe.ParameterRemovedBreakage href "" "griffe.ParameterRemovedBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for removed parameters.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = PARAMETER_REMOVED
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.
ReturnChangedTypeBreakage ¤
flowchart TD
griffe.ReturnChangedTypeBreakage[ReturnChangedTypeBreakage]
_griffe.diff.Breakage[Breakage]
_griffe.diff.Breakage --> griffe.ReturnChangedTypeBreakage
click griffe.ReturnChangedTypeBreakage href "" "griffe.ReturnChangedTypeBreakage"
click _griffe.diff.Breakage href "" "_griffe.diff.Breakage"
Specific breakage class for return values which changed type.
Parameters:
-
obj
¤Object
) –The object related to the breakage.
-
old_value
¤Any
) –The old value.
-
new_value
¤Any
) –The new, incompatible value.
-
details
¤str
, default:''
) –Some details about the breakage.
Methods:
-
as_dict
–Return this object's data as a dictionary.
-
explain
–Explain the breakage by showing old and new value.
Attributes:
-
details
–Some details about the breakage.
-
kind
(BreakageKind
) –The kind of breakage.
-
new_value
–The new, incompatible value.
-
obj
–The object related to the breakage.
-
old_value
–The old value.
kind class-attribute
instance-attribute
¤
kind: BreakageKind = RETURN_CHANGED_TYPE
The kind of breakage.
as_dict ¤
explain ¤
explain(style: ExplanationStyle = ONE_LINE) -> str
Explain the breakage by showing old and new value.
Parameters:
-
style
¤ExplanationStyle
, default:ONE_LINE
) –The explanation style to use.
Returns:
-
str
–An explanation.