Python code completion gets an assist from machine learning
The makers of a new programmer’s assistant for Python developers are tapping machine learning technology to build new kinds of programming tools. Kite, billed by its creators as “the AI copilot for Python programmers,” is a code-completion system designed to go beyond the conventional auto-suggest algorithms found in IDEs.
Kite integration is available for most every major code editor—Atom, PyCharm/IntelliJ, Sublime Text, Microsoft Visual Studio Code, and Vim. Right now, Kite supports only Python, but the Kite development team plans to support other languages as well.
Kite’s code completion is powered by a machine learning model created by scanning publicly available Python code on GitHub. The model isn’t trained on the text of the code, but on abstract syntax trees derived from the code. This provides the models with some sense of the code’s intent and context, delivering auto-suggestion and auto-completion of common code patterns based on how you and other developers have written code in the past.
The newest release of Kite expands its code suggestion functionality to better demonstrate what’s possible with this approach. Previous versions of Kite could only suggest the next likely token, like a variable reference, at any given point. The latest version can suggest an entire function call, including all available arguments and their meaning.
Kite’s latest version also includes the ability to deploy Kite’s machine learning model on a local system, rather than a remote server. This parallels other advances in machine learning to make models more compact and easier to deploy on hardware with modest storage and CPU requirements, such as a smartphone.