I'm looking for a tool that compares Python code to a reference version of that code (e.g. the repository's main branch) and determines if the changes necessarily lead to backwards-incompatibility because public function/class/method signatures have changed or they have been moved/deleted.
Ideally, there should be a way to make it understand which functions/classes/methods are part of the package's public interface beyond just looking at whether there is an underscore prefix or not - perhaps a decorator or certain comment to annotate things meant to be public, or better yet a check for whether they are mentioned in the package's docs or not.
Another convenient feature would be if it could automatically check whether the semantic version (SemVer) difference between the compared revisions is compatible with the changes or not, but this would be trivial to implement given a tool that merely performs the described breaking change detection.
Obviously, there is no general way to, conversely, check if backwards-compatibility is ensured (Rice's theorem), but a simple check of the interface as described above at least catches the most obvious incompatibilities that humans might still miss.