pystasis is a tool to help you catch breaking changes in your Python projects. It does this by comparing AST (abstract-syntax tree) changes between commits in git repositories.
pip install pystasis
class User:
id: uuid
name: str
relatives: List[User]
This is a typical User class, which maps a name to a list of family members. Now let's imagine that we would like to track
any relations the user has (friends, acquaintances) rather than just family members. We can just rename the field as such:
class User:
id: uuid
name: str
relativesrelations: List[User]
However, this is a breaking change, and if we maintain API endpoints we cannot guarantee that downstream applications
will not break. pystasis can catch this:
$ pystasis
WARNING - relatives has been renamed or removed in User (user.py)
- repo: https://git.sr.ht/~regan-koopmans/pystasis
rev: 5888c267
hooks:
- id: pystasis