Using the Spyder plugin

In this article, you'll learn how to access all the features the Spyder plugin has to offer for Python.

Prerequisites

The only prerequisites are that you have Spyder 4.0+ installed, Kite Engine running and the Kite plugin for Spyder enabled. If you don't have plugin enabled, you can do so by opening Spyder's preferences, clicking on "Completion and linting" on the left hand side, clicking on the "Advanced" tab, and then checking "Enable Kite".

Checking the Status of Kite

If Kite is installed properly, you should see a small Kite logo at the bottom status bar of the Spyder window. 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:

Icon Message Description
Kite: not installed Kite Engine is not installed.
Kite: not running Kite Engine is not running.

Kite: indexing Kite Engine is analyzing your code.
Kite: 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.

Writing Code and Accessing Features

In the following sections, the $ character indicates the position of your editor's text cursor.

Before we start...

To get the most out of Kite's features, we recommend that you change several of Spyder's settings. To do so, open Spyder's preferences, click on "Completion and linting" on the left hand side, and under the "Completion" tab, make the following changes:

  • Ensure that "Enable code completion" is checked.
  • Ensure that "Show completions on the fly" is checked.
  • Ensure that "Enable code snippets" is checked.

Completions

To start, open a Python file. Make sure that this file has been saved with a .py extension. Now type the following code:

import n$

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 numpy as np
np.$

In the case of name and attribute completions, Kite will also provide the kind of value represented by the completion (e.g. module or function) as well as a short snippet of the documentation if available.

Function signatures

Continuing with the example code above, make a function call to linspace by typing the opening parentheses.

import numpy as np
np.linspace($

Kite should show you information about how to call np.linspace.

The top half of the UI shows the arguments that the function accepts. Arguments with default values will also have their default values shown.

As you type, Kite will stay in-sync with your cursor and highlight which argument you are currently focused on.

Snippets

When you call a function, Kite may suggest snippets as completions you may choose. Snippets are denoted by placeholders enclosed with <>. In the screenshot below, the highlighted completion has two placeholders: <my_start> and <my_stop>.

When you select a snippet, you can use the tab key to jump between placeholders as you edit them.

Viewing documentation

Kite can also quickly retrieve documentation for the code you are working with and show it in the Copilot. If you turn on the Copilot's follow cursor feature, you will automatically see the documentation for the symbol underneath your cursor as you code.

Still need help? Contact Us Contact Us