(
new_obj: griffe.Object | griffe.Alias,
old_obj: griffe.Object | griffe.Alias,
*,
path: list[str],
)
| 57 | |
| 58 | |
| 59 | def find_breaking_changes( |
| 60 | new_obj: griffe.Object | griffe.Alias, |
| 61 | old_obj: griffe.Object | griffe.Alias, |
| 62 | *, |
| 63 | path: list[str], |
| 64 | ) -> Iterator[Text | str]: |
| 65 | # a class that moved and is imported from its new module is still public. Old-side |
| 66 | # imports aren't followed, so a class imported at the baseline has no members checked |
| 67 | new_members = public_members(resolve_import(new_obj)) |
| 68 | old_members = public_members(old_obj) |
| 69 | |
| 70 | for name, old_member in old_members.items(): |
| 71 | if isinstance(old_member, griffe.Alias) and len(path) > 2: |
| 72 | # ignore imports in `/types/` for now, they're technically part of the public API |
| 73 | # but we don't have good preventative measures in place to prevent changing them |
| 74 | continue |
| 75 | |
| 76 | new_member = new_members.get(name) |
| 77 | if new_member is None: |
| 78 | cls_name = old_member.__class__.__name__ |
| 79 | yield Text(f"({cls_name})", style=Style(color="rgb(119, 119, 119)")) |
| 80 | yield from [" " for _ in range(10 - len(cls_name))] |
| 81 | yield f" {'.'.join(path)}.{name}" |
| 82 | yield "\n" |
| 83 | continue |
| 84 | |
| 85 | yield from find_breaking_changes(new_member, old_member, path=[*path, name]) |
| 86 | |
| 87 | |
| 88 | def main() -> None: |
no test coverage detected