()
| 86 | |
| 87 | |
| 88 | def main() -> None: |
| 89 | try: |
| 90 | against_ref = sys.argv[1] |
| 91 | except IndexError as err: |
| 92 | raise RuntimeError("You must specify a base ref to run breaking change detection against") from err |
| 93 | |
| 94 | package = griffe.load( |
| 95 | "anthropic", |
| 96 | search_paths=[Path(__file__).parent.parent.joinpath("src")], |
| 97 | ) |
| 98 | old_package = griffe.load_git( |
| 99 | "anthropic", |
| 100 | ref=against_ref, |
| 101 | search_paths=["src"], |
| 102 | ) |
| 103 | assert isinstance(package, griffe.Module) |
| 104 | assert isinstance(old_package, griffe.Module) |
| 105 | |
| 106 | output = list(find_breaking_changes(package, old_package, path=["anthropic"])) |
| 107 | if output: |
| 108 | # soft_wrap: CI stdout is not a TTY, so rich would otherwise hard-wrap long symbol paths at 80 columns |
| 109 | console = Console(soft_wrap=True) |
| 110 | console.print(Text("Breaking changes detected!", style=Style(color="rgb(165, 79, 87)"))) |
| 111 | console.print() |
| 112 | |
| 113 | for text in output: |
| 114 | console.print(text, end="") |
| 115 | |
| 116 | sys.exit(1) |
| 117 | |
| 118 | |
| 119 | main() |
no test coverage detected