66.8 Annotating Third-Party Libraries Without Stubs
Right, so you’ve imported a glorious third-party library that does exactly what you need. You’ve dutifully annotated your own code, feeling the warm glow of type safety. You run mypy and… a firestorm of red. The library has no type hints. Your brilliant annotations are now pointing into a void, and your type checker is having a panic attack. Welcome to the most common real-world hurdle in Python’s type system. You can’t change the library’s source code, but you also refuse to surrender to Any and the ensuing chaos. Let’s fix this.