Jupyter Notebooks Extensions
Jupyter allows you to add new functionality to Notebooks through extensions. In this lesson, you’ll see where to get extentions, how to install them, and how to enable and disable them using an extension manager.
Note: If you are using the Python Anaconda distribution, these Jupyter notebook extensions might already be installed and activated. This tutorial assumes that you are working with a vanilla Jupyter notebooks installation.
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
Okay, so I already had those installed, that’s why it’s coming up as
already satisfied, but otherwise it would have installed this. And the next thing we’re going to grab is a Notebook extensions configurator, which is a useful tool for enabling and disabling specific extensions without having to do it from the command line.
01:08 All right, this is done. And the last thing I need to do now is I need to enable this Notebook extension. Generally, you would have to do this with every single one of the extensions, but using this extension manager, we’d only need to activate this one and then we can do the rest of them through a graphical user interface.
Here’s the command to enable it. We’re using a
jupyter command for this,
jupyter nbextensions_configurator—so, that would be the name of whatever extension you want to activate—and then you say
enable to activate it,
disable for disabling it.
02:27 And here we are. We see now the Nbextensions tab here on our Notebook server. I’ll go ahead and click that. And here you can see a long list of pre-installed extensions that came with this package that we downloaded from GitHub. There’s a lot of them.
03:21 The Variable Inspector collects all the variables, and you can take a look at them and what’s currently defined. That sounds useful. And yeah, there’s a lot of them. I just encourage you to try them out.
03:34 There’s syntax highlighting, there’s code autocompletion, there’s PEP8 linting. There’s an extension that allows you to publish your Notebook as a Gist right away. Let’s activate that too, and go over to our Notebook to take a look.
03:56 Since I restarted the Notebook server, I also have to start the kernel for our Notebook again. I restructured it a bit, took away most of the Markdown. And here, now we can see—after activating these extensions—I can see these things popping up here, and one of them is down here.
04:14 So, what do we have? I’m going to run these two cells, so I put these two variables in memory, and now using the Variable Inspector I can take a look in this floating window—I can move it around—and it tells me what’s the current value of all of the different variables that are currently defined inside of my Notebook. I can sort them by Name, Type, Size, or Value. So, that’s one example. Then there’s the Scratchpad, which essentially, from what it seems, is just a mini Notebook, right in here.
I can create variables in here, execute them in the same way that I do without Notebook extensions. Print out, play around, and try it out. And these variables that I define in here are even available inside of the Notebook afterwards, so I could go ahead and print out
05:17 Another extension that could be fun and helpful for some people is this Gist-it. I can just click this button and then right from here, create a public Gist. There’s a possibility also to sign in with your account, to then have the Gist associated to your GitHub account.
05:38 So, I guess it requires authentication to create a Gist. So, these are just some quick examples of possible ways that you can extend your Jupyter Notebooks. As you saw, there’s a lot of them and there’s many more.
Become a Member to join the conversation.