Reputation: 425
I am trying to add the hide_code option to my ipython notebook (jupyter, version 4, python 2.7). It is supposed to add a button or an option to the cell pull-down menu that allows me to hide the code in my ipython notebooks. I have successfully run the 'pip install hide_code' command from the terminal (MacOS X El Capitan). I have restarted the notebook and expected to see a new I have tried to restart the notebook program but nothing happens. I am not computer savvy enough to know what to do from here. Did I miss something?
Here is the github repository for the code:
https://pypi.python.org/pypi/hide_code/0.3.0
Upvotes: 1
Views: 3123
Reputation: 81
OK I found a way to do it.
import hide_code.hide_code as hc; dir = "<full path to Jupyter config directory>"; hc.install(dir)
It will still not work, but it will copy a javascript file (hide_code.js) into that directory. We will use it in a bit.
cd ~ find -name keyboard_shortcut_editor
Mine finds it ./.local/share/jupyter/nbextensions/keyboard_shortcut_editor Yours should be there too.
cd ./.local/share/jupyter/nbextensions/ ls
You see full list of various extensions. Let's copy one of them into hide_copy:
cp -r hide_input hide_code cd hide_code ls
cp ~./ipython/hide_code.js ./main.js
Now, if you launch your jupyter and go to http://localhost:8888/nbextensions, you will see Hide Code. And if click on that checkbox, it's on. Here are snapshots:
It is a weird sequence. But it worked for me. And the main thing, it puts it right where it needs to be. Hide_code actually needs to be a part of Nbextensions. I don't know why it is not. That way it's easy to turn it on and off any way you like it.
Upvotes: 1
Reputation: 5931
As described in the documentation: https://github.com/kirbs-/hide_code, you can troubleshoot by running the following code with appropriate Jupyter config directory location:
import hide_code.hide_code as hc
dir = "<full path to Jupyter config directory>"
hc.install(dir)
Upvotes: 0