▲ | emeryberger 7 months ago | |||||||||||||||||||||||||||||||||||||||||||
I agree that writing type hints can be painful, especially if you are starting with a large code base that is mostly untyped. You might consider using RightTyper (https://github.com/RightTyper/RightTyper) - basically run your Python 3.12+ program with it, and it will add type hints to your code. It’s fast, basically automatic, and by design RightTyper avoids overfitting to your types, letting a type checker like MyPy surface edge cases. In effect, the type checker becomes an anomaly detector (Full disclosure, I am one of the authors of RightTyper.) From the GitHub page: RightTyper is a Python tool that generates types for your function arguments and return values. RightTyper lets your code run at nearly full speed with almost no memory overhead. As a result, you won't experience slow downs in your code or large memory consumption while using it, allowing you to integrate it with your standard tests and development process. By virtue of its design, and in a significant departure from previous approaches, RightTyper only captures the most commonly used types, letting a type checker like mypy detect possibly incorrect type mismatches in your code. | ||||||||||||||||||||||||||||||||||||||||||||
▲ | Cerealkiller050 7 months ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||
Dealing with this currently in a giant old legacy python 2.7 codebase that was migrated to 3.10 in the past year. I do see the requirement @ 3.12, is there a specific reason for this that wouldn't be available to 3.10? | ||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||
▲ | joshdavham 7 months ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||
Why is your GitHub organization’s logo, the AWS logo? | ||||||||||||||||||||||||||||||||||||||||||||
|