Kite gives you ML-powered autocompletions and rich documentation inside JupyterLab. This guide will teach you everything you need to know about Kite in 5 minutes or less.
💡 Tip: You can open this file at any time with the command
Kite: Open Tutorial
in JupyterLab's command palette.
Make sure that the Kite icon at the bottom of the window reads Kite: ready
.
Kite: not running
, please start the Kite Engine first.Kite: not installed
, please download and install Kite first.Step 1a
Run the code cell below with all the necessary imports 👇
# Run me!
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Matplotlib is building the font cache; this may take a moment.
Step 1b
Let's try typing out some code to plot a sine graph. As you type, Kite will automatically show you completions for what you're going to type next.
💡 Tip: You can turn completions docs on and off in JupyterLab's command palette with the command
Kite: Toggle Docs Panel
.
💡 Tip: The starred completions ★ are from Kite Pro. You can start your free Kite Pro trial anytime. Afterwards, if you choose not to upgrade, you can still use Kite 100% for free.
Try typing out the code yourself to see Kite's autocompletions in action.
x = np.linspace(-np.pi, np.pi, 50)
y = np.sin(x)
plt.plot(x, y)
Type this code in the cell below 👇
# Put code in me
x = np.linspace(-np.pi, np.pi, 50)
y = np.sin(x)
plt.plot(x, y)
[<matplotlib.lines.Line2D at 0x7fa4200e4b90>]
You can still use JupyterLab's builtin kernel completions. These are particularly useful when you need to access a DataFrame
's column names.
Step 2a
First, run the code cell below to get some sample data to store in a DataFrame
👇
# Run me!
url = 'https://kite.com/kite-public/iris.csv'
df = pd.read_csv(url)
df.head()
sepal_length | sepal_width | petal_length | petal_width | species | |
---|---|---|---|---|---|
0 | 5.1 | 3.5 | 1.4 | 0.2 | setosa |
1 | 4.9 | 3.0 | 1.4 | 0.2 | setosa |
2 | 4.7 | 3.2 | 1.3 | 0.2 | setosa |
3 | 4.6 | 3.1 | 1.5 | 0.2 | setosa |
4 | 5.0 | 3.6 | 1.4 | 0.2 | setosa |
Step 2b
Let's plot a scatter graph of sepal length vs. sepal width. When you are accessing a DataFrame
's columns, you'll still need to hit tab
to request completions from the kernel.
Try requesting kernel completions yourself.
plt.scatter(df['sepal_length'], df['sepal_width'])
Type this code in the cell below, making sure to hit tab
when you are filling in the column names 👇
# Put code in me
plt.scatter(df['sepal_length'], df['sepal_width'])
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-81be8620ec67> in <module> 1 # Put code in me ----> 2 plt.scatter(df['sepal_length'], df['sepal_width']) NameError: name 'plt' is not defined
If you've enabled "docs following cursor" in the Copilot, the Copilot will automatically update with the documentation of the identifier underneath your cursor.
Step 3a
Try it yourself! Just click around in the code cells of this notebook and see the Copilot update automatically.
Now you know everything you need to know about Kite's JupyterLab plugin. Kite is under active development and we expect to ship improvements and more features in the near future.
In the meantime, if you experience bugs or have feature requests, feel free to open an issue in our public GitHub repo.
Happy coding!