Smart Code Auto-Completion in Jupyter Notebook

Smart code auto-completion makes your work much more convenient

Code completion is a very convenient way to help one write codes quickly and efficiently, improve the development speed. The Jupyter notebook includes the function of code completion. Simply type object_name, say numpy for example, then type . and <TAB> key on your keyboard, and you will see the attributes of the object (numy in our example here).

However, the default code-completion of Jupyter notebook lack intelligent function. In this post, I will display how to install a more smart code auto-completion plugin and how to use it as follows.

1. A Smart Code Auto-Completion Plugin

This plugin calledTabNine was developed by Wenmin Wu, which is a smart auto-completion plugin based on Deep Learning. This plugin supports macOS, Linux and Windows, and it supports Chrome, Firefox and Safari browsers while it does not support IE.

(1) Installation

The installation is straightforward, and here I divide it into the following three steps. Open your terminal, CMD, PowerShell, Anaconda prompt, or just inside Jupyter notebook, type the following commands step by step.

Step 1: install the package

pip install jupyter-tabnine --user

Step 2: install the notebook extension

jupyter nbextension install --py jupyter_tabnine --user

Step 3: enable notebook extension and server extension

jupyter nbextension enable --py jupyter_tabnine --user
jupyter serverextension enable --py jupyter_tabnine --user

(2) Start to use it

When you start the Jupyter notebook, you will see the loading information of TabNine Plugin.

Let’s create a new Jupyter notebook or open an existing one, and then go to help menu, and you will notice that Jupyter TabNine has been added.

Let’s type some codes and see if it works. If it works, you should see something similar as the following image.

If it does not work, you should close the Jupyter notebook and all browser tabs and restart the Jupyter notebook once more.

(3) Temporally stop plugin

If you want to stop the plugin temporally, just go to:

help menu
 –> deselect the check mark of Jupyter TabNine

(4) Uninstall the plugin

You can uninstall the plugin using the following command.

jupyter nbextension uninstall --py jupyter_tabnine
pip uninstall jupyter-tabnine

2. Video Version

If you like a video version of this post, please go to my YouTube channel to watch it. If these are helpful, please subscribe to my channel to show your support.

3. Course

If you are interested in learning Jupyter notebook in details, you are welcome to enroll one of my course  Practical Jupyter Notebook from Beginner to Expert.

0 - 0

Thank You For Your Vote!

Sorry You have Already Voted!

Please follow and like me:

Leave a Reply

Your email address will not be published. Required fields are marked *