https://peps.python.org/pep-0751/ is a good place to start, hopefully there will be tooling that supports this soon... looks like there is some initial work at https://github.com/brettcannon/mousebender/tree/pep