How sassy your Jupyter Notebook can be?

Curious Dev
Curious Dev Grail
Published in
3 min readApr 27, 2019

Back in the days when the programming is at inaugural stage the programmer who knows every piece of code, or library is considered to be the mighty developer, and it was quite easy to remember almost everything. But the evolution of Computer science industry become so huge that you can’t remember everything (especially when, with every minute there is new JavaScript Framework is in market, new Malware being evolved and lot more) at fingertips. Nowadays a Person who have expertise in understanding real world situation and cast them into code is considered to be a better developer.

And at that time the person involved in Computer science fields are either mathematician, physicists, and definitely the Computer Engineer. But with the introduction of fields like Machine Learning, Data Science, Blockchain, IT sector is no more considered to be perfectly owned by the nerdy Computer Geeks. It is now a mix of person belonging to various industry.

Memorizing syntax function is no more the part of developer side, its on the tool or IDE you use to develop your large scale applications, and that is done through add-ons or plugins like Intellisense that suggest you minutes details of your code that you even can’t think of without it and google possible. Though every IDE is now having that Intellisense plugin already integrated, But the Machine Learning enthusiasts loves to work on tool, what they call is Notebook or Jupiter Notebook.

Coding every piece without Intellisense isn’t smart way, when you are developing something that is going to make something smarter.

But rarely (especially beginner) knows that Your Jupiter Notebook just like any other IDE can have Intellisense capabilities with few tweaks to your notebook. Now lets understand how you can have that powers in your hand.

How to make Your Notebook Sassy?

You can do it to ways either:

  1. Adding Intellisense to Specific Notebook
  2. Adding Intellisense Globally to every Notebook.

It is very simple process let’s see each one by one.

Adding Intellisense Specifically to Notebook

At the Beginning of Your Notebook In the very first cell write this:

%config IPCompleter.greedy=True

And when you are Coding something Just press Tab to see the possible option that you can substitute with the half completed snippet. If you want to know the possible arguments a method or function takes or the type of parameters it accepts or its returns Type Just Press Shift + Tab together

Adding Intellisense Globally to every Notebook.

Suppose You don’t like messy notebooks like me and instead want to keep it somewhere else then you can do it in IPython Configuration file. That you generally find at ~/.ipython/profile_default/ipython_config.py if you are using Mac or Linux.

If You can’t find it You can create one by issuing a command in terminal:

~$ ipython profile create

Just go to this file and search for greedy remove the comment of this configuration and change False to True.

c.Completer.greedy = True

Save It . Now You don’t need to write the command at the top of every new notebook.

Though the above tweaks makes your notebook a little sassy but stills it waits for your input to predict the possibilities to complete the output. To make it little more sassy you need to install an unofficial extension jupyter_contrib_nbextensions .You need to enter the following command to the terminal.

~$ pip3 install jupyter_contrib_nbextensions
~$ jupyter contrib nbextension install --user

The second command will make install some necessary items , and make some changes to the config files of jupyter for the intellisense to work properly.

After installing this extension you will find lots of amazing tweaks that you can do to make your notebook work more perfectly, to enable intellisense you will find Hinterland check it,reload your notebook. And you are done. Now you no more need to press tab or shift+tab to get the possible hint. For every key press, You will the possible substitute available.

That’s all for now, If the post helped you a bit please share with your friends. Any comments or reviews are most welcomed. Keep in touch more amazing post are coming Soon.

For Quick Introduction about Jupyter Notebook: Jupyter Notebook Tutorial: Definitive Guide (article) — DataCamp

--

--