.title-slide # Static Analysis in PyCharm .right[Andrey Vlasovskikh] .right[JetBrains] .right[#PyConUS 2019] .right[2019-05-02] --- # About me * I'm [@vlasovskikh](http://twitter.com/vlasovskikh) * From St. Petersburg, Russia * The technical lead of PyCharm * Have been doing type inference for Python since 2011 * Contributions to PEPs 484, 561 --- # The most popular type checker? .center[
] * 35% of all Python developers use PyCharm * Our type checker is on by default in the editor * Python Developers Survey 2018 --- # Type checking on CI * The most popular type checker on CI? * It is likely Mypy * Use the same tool in IDE and CI * Mypy plugins for PyCharm * You can run PyCharm on CI * `
/bin/inspect.sh` --- # Typing tools != type checkers * Types are not only type checking * Examples from PyCharm --- # Example 1. Code completion .center[
] --- # Example 2. Find usages & rename .center[
] --- # Example 3. Call hierarchy .center[
] --- # Code insight in PyCharm * Analyze a single Python expression * Dependency graph * Inter-procedural type inference * Analyze all project & library files * If you can import a module, your IDE should analyze it * Type hints are not necessary * You expect that your IDE knows your code even without type hints --- # Code inspections in PyCharm .center[
] * Dozens of code inspections on each edit * The type checker is only one of them --- # Inspections have to be incremental * Run code inspections on each edit * Inter-procedural analysis only for the current file * The typing PEPs don't require non-incremental analysis * I hope it will remain true for new PEPs --- # Q&A * Summary * Types have more applications than type checking * Ensure new PEPs work well for interactive editors * Slides are available on Twitter * [@vlasovskikh](http://twitter.com/vlasovskikh)