Using the Atom plugin for Python
In this article, you'll learn how to access all the features the Atom plugin has to offer for Python.
The only prerequisites are that you have Kite Engine running and the Atom plugin installed. If you don't have the Atom plugin installed, you can learn how to do so here.
Note: If you installed the Atom plugin while Atom was already running, you'll need to restart Atom for the plugin to activate.
Checking the Status of Kite
If Kite is installed properly, you should see a small Kite logo at the bottom right corner of the Atom window. Hovering your mouse over this icon will tell you the current status of Kite.
There are a handful of possible states Kite can be in, as described in the following table:
|Kite is not installed||Kite Engine is not installed.|
|Kite is not running||Kite Engine is not running.|
|Kite engine is indexing your code||Kite Engine is analyzing your code.|
|Kite is ready||Kite is ready to go — start coding!|
|No icon||No message||This typically means that you are coding in an unsaved file or a filetype not yet supported by Kite.|
Note: If you're running Kite for the first time, it may take several minutes for Kite to finish indexing your codebase.
For the first two (red) states, the Atom plugin will generally allow you take action to get out of the invalid state. For example, the plugin will allow you to start Kite Engine from Atom directly.
Clicking on the icon will open a menu that will allow you to access your settings or get help.
Writing Code and Accessing Features
In the following sections, the
$ character indicates the position of your editor's text cursor.
To start, open a Python file. Make sure that this file has been saved with a
.py extension. Now type the following code:
A list of suggested completions should automatically appear.
Kite can provide completions for Python keywords, name expressions or attribute expressions. The example above illustrates a name expression completion. An example of an attribute completion would be:
import json json.d$
In the case of name and attribute completions, Kite will also provide the kind of value represented by the completion (e.g.
function) as well as a short snippet of the documentation if available.
Continuing with the example code above, complete the function call to by typing the opening parentheses.
import json json.dumps($
Kite should show you information about how to call
The top half of the UI shows the arguments that the function accepts. Arguments with default values will also have their default values shown. You may also click on the
**kw link to show the arguments that are found in the keyword arguments dictionary.
As you type, Kite will stay in-sync with your cursor and highlight which argument you are currently focused on.
The “How others used this” section in the bottom half of the UI shows you common ways other programmers use the function
json.dumps. Kite learns these calling patterns by analyzing all the open source code available on GitHub and then ranks them from most popular to least popular. If you are calling a function that you have defined locally, Kite will extract patterns from your codebase directly instead of GitHub.
Kite Pro completions
If you have upgraded to Kite Pro, Kite may suggest completions that can complete multiple words at once. For example, Kite can provide snippets for calling functions. When a snippet is selected, you will be able to cycle through the arguments with the
tab key and make the necessary changes.
Kite can also suggest completions for generic code structure, such as control structures and variable assignments, to name a few.
You can learn more about Kite Pro here.
Kite can also quickly retrieve documentation for the code you are working with. If you hover your mouse over an identifier, you can click on the “Docs” link to open the documentation in the Copilot.
You may also select the
Kite: Docs at Cursor command from the command palette.
As shown in the screenshot above, you can also trigger the UI using a keyboard shortcut. When triggered, the documentation shows up in the Copilot.
Jump to definition
You can also jump to the definition of a module, class or function from your local codebase using Kite. The hover UI provides a “Def” link to do so.
Search Stack Overflow (experimental feature)
The Atom plugin also allows you to search common Python questions on Stack Overflow. To access this feature, you can either click on the Stack Overflow icon in status bar, or you can use the command
Kite: Search Stack Overflow.
You will then be shown a search box that you can use to lookup a question.
Selecting a search result will show you the relevant Stack Overflow questions and answers.
Selecting an answer will insert the code directly into your file. You will need to modify the inserted code to match your needs.
The Atom plugin provides a number of commands for ease of use. The GitHub repository contains information on the available commands.