How we Dealt with Poor Code Analysis Support in Our Heavy Projects
summary
Decorators that wrap functions keep runtime signatures but break IDE static analysis, so the solution is generating PEP 484/561 stub (.pyi) files plus a py.typed marker; an importer introspects safe modules, extracts inspect.signature and docstrings, and writes stubs automatically. The open‑source tool stop-maker requires modules to set __all__, emits corrected signatures and imports, and restores autocompletion and type checks for IDEs and linters; it works in production with that limitation.
AI-written summary · about
chapters (9)
- 0:00Intro
- 0:45Demonstration
- 2:12Login decorator
- 4:27What went wrong
- 6:55Autonomous decorator
- 11:10Stop files
- 16:15Solution
- 17:35Code
- 22:17Bonus
related talks
28mGradual Typing in Python
32mType-checked Python in the real world
28mPreventing headaches with linters and automated checks
25mPEP 8: How to Avoid Being a Python Hooligan
27mAn Overview of the Python Code Tool Landscape 2023
20mHidden Hacks in Linters for Better & More Secure Code
27mPyre, Lints, Codemods, Code Quality, and You
22mPublishing well formed Python packages
