Highlight typos in the jupyter notebook markdown - jupyter

When I write something in the jupyter notebook markdown field, the typos are not highlighted and often I ended up with something like this:
In almost all IDEs I have used so far, the typos are highlighted with a curly underline which was very convenient for me. Something like this:
Up till now I have not found anything that allows me to see this type of highlights. Does it exist?

The popular Jupyter Notebook bundle extension from Jupyter-contrib contains a spell checker. You can install and enable this (with admin privileges) like so:
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable spellchecker/main
This may be the most popular spell checker for Jupyter Notebooks, but note that it simply highlights words not in its dictionary, and does not offer corrections.
If the extension installed properly, you will see this message in the command line:
Now, in the browser, after opening Jupyter, you will see the button labelled "abc" beside the keyboard button, which you can toggle to enable/disable spell check:
The jupyter-contrib library has many other useful modules such as code folding and table of contents.

Run the following in a terminal:
ipython install-nbextension https://bitbucket.org/ipre/calico/downloads/calico-spell-check-1.0.zip
ipython install-nbextension https://bitbucket.org/ipre/calico/downloads/calico-document-tools-1.0.zip
ipython install-nbextension https://bitbucket.org/ipre/calico/downloads/calico-cell-tools-1.0.zip
jupyter nbextension enable calico-spell-check
You can see typos like
Find out more
Afterwards, you need to activate the spell check in the Jupyter Notebook:
%%javascript
IPython.notebook.config.update({
"load_extensions": {"calico-spell-check":true,
"calico-document-tools":true,
"calico-cell-tools":true
}
})

The spellchecker and some other extensions from jupyter_contrib_nbextensions is incompatible with the ipython version 5.8.0. and later. (Found that it works in some cases for the version 5.0.0 [refer issue page of the same]. I'm not aware of its compatibility for the ipython versions between 5.0.0. to 5.8.0., please do comment if anyone knows).
The calico's nbextension 'spellchecker' available at https://bitbucket.org/ipre/calico/downloads/calico-spell-check-1.0.zip is an outdated version [dated 2015]. But calico had updated their nbextensions and made avaliable at the github repository [latest dated 2018]. It works fine for the ipython version 5.8.0.
Installation
git clone https://github.com/Calysto/notebook-extensions.git
cd notebook-extensions
jupyter nbextension install calysto --user
jupyter nbextension enable calysto/spell-check/main
Check its status:
jupyter nbextension list
When you now open or reload a notebook, there would be a new button visible with a check mark icon next to the button to open the command palette. You may click on it to check the spelling mistakes in the markdown cell.

Related

Does VS Code install some extensions automatically?

I noticed that I have many extensions installed that I don't recall manually installing, e.g. isort, jupiter cell tags, etc.
I only installed the "python" and "jupyter notebooks" extensions myself. Those others seem to be installed later without my knowledge.
Does VS Code install extensions automatically somehow?
To answer the general question
Yes, VS Code does come with some extensions installed "out-of-box". It calls those extensions "Built-In" extensions. If you open the extension page of one of those extensions, it will say:
Notice: This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
One example of this is the vscode.typescript-language-features extension. You can get a list of all running with the Developer: Show Running Extensions command. It's kind of hard to find them otherwise, since they don't normally show up in the extensions sidebar.
In your particular case, you misunderstood something
The Python and Jupyter extensions you installed are extension packs. They include isort and Jupyter Cell Tags (as well as others).
You can see for yourself.
https://marketplace.visualstudio.com/items?itemName=ms-python.python:
The Python extension will automatically install the Pylance, Jupyter and isort extensions to give you the best experience when working with Python files and Jupyter notebooks.
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter:
The Jupyter Extension will automatically install the following extensions by default to provide enhanced Jupyter notebook experiences in VS Code.
Jupyter Keymap - to provide Jupyter-consistent keymaps
Jupyter Notebook Renderers - to provide renderers for MIME types such as latex, plotly, vega, etc.
Jupyter Cell Tags and Jupyter Slide Show - to provide the ability to tag cells in notebooks and support for presentations

Missing Jupyter Notebook Kernels in VSCode

I have multiple people working on the same AWS EMR cluster to run some Spark jobs. This is being done through Jupyter Notebooks which are created/modified using the Jupyter extension installed on a SSH Target through vscode. The modules are installed on the base conda environment that is included with the /emr/notebook-env/. Some people can see the correct kernel that is associated with the base conda environment in their vscode window when working on notebooks. However, some don't see this kernel as an option. How do I make sure that everyone's vscode lists the appropriate kernel when they are creating new notebooks or modifying existing notebooks?
Another potential reason this could happen is that the Jupyter exentsion of VSCode is not installed.
To add the Jupyter extension for VSCode, search for it by clicking extensions icon in lefthand toolbar, then searching for Jupyter and installing.
The user having the issue had to update their vscode and that fixed the issue

Jupyter Notebook "hidecode" tag not working?

I am trying to use the hidecode tag as shown here, but for some reason, it's not working on my local Jupyter Notebook server. The code remains visible, and no button on the right of the cell is displayed. I even downloaded the same notebook used in the page above, no dice.
I am running Ubuntu 18.04.2 LTS, Jupyter Notebook Server 5.2.2, Python 3.6.7, and IPython 5.5.0. The command I ran to start the server is sudo jupyter notebook --allow-root.
If you need any more info, please let me know. I appreciate any help I can get in figuring this out.
If you want to hide the code, the output or the prompt of your cells you can install the hide_code extension:
https://pypi.org/project/hide_code/0.2.0/
Stop jupyter
Run these commands
pip install hide_code
jupyter nbextension install --py hide_code
jupyter nbextension enable --py hide_code
jupyter serverextension enable --py hide_code
NOTE: I run the first two commands as root and the last two with the same user used to launch jupyter.
Restart jupyter
I found this extension very useful because I needed to print the notebook to a pdf file and all the tools like nbpublish, nbconvert was failing. In this way I can print the notebook directly from the "print" feature of the browser.

Real-time linting of Python with VSCode

Recently I'm using VSCode as my Python IDE, and I install
DonJayamanne/pythonVSCode, which supports linting. However, the linter only works when saving, but what I want is real-time linting. The workaround suggested by the author is to set files.autoSave to on, so that the linter will work whenever the file is automatically saved. There's a relevant discussion on Github, for your reference.
Since I don't want to turn on auto-save function, is there any way to do real-time linting of Python with VSCode? Or is there any suggested extension?
If you use shift + cmd + P (or ^+ctrl+P for windows) or go to View > Command Palette and type "Lint"
The Command Palette allows you to execute different commands, from here you can enable/disable Linting and select which Linter you would like to use. Most popular is PyLint but you can select Flake8 or Pep8 or whatever you like.
I believe you need to do these things before the linter works in real-time.
To scan for problems with your code without saving first, use shift + cmd + M, you will receive an error code in the vscode Terminal.
EDIT
Update 4 Jul 2022
New version of python extension deprecates "python.pythonPath" and suggest to use this instead.
"python.defaultInterpreterPath": "/usr/bin/python3",
Put these lines in .vscode/settings.json
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "/usr/bin/python3",
"editor.formatOnSave": true
}
And install autopep8 package.
Use pip to install it
python3 -m pip install autopep8
Or in Debian based as python3-autopep8 exists in repo you can run
sudo apt install python3-autopep8
And then python linting on vscode will work.
Also, the Warning menu will activate.
Hint that I set run linter onsave.

Stop ipython pop-up docs

In the ipython qtconsole it automatically displays the documentation for a function when I type the opening parenthesis. For example, when I'm typing
plt.show()
the documentation for pyplot.show is displayed when I've typed
plt.show(
This documentation is displayed in a pop-up window that, much more often than not, blocks my view what I'm typing. Is there a configuration to stop the ipython qtconsole from doing this?
The feature to which you refer is calltips or more precisely IPythonWidget.enable_calltips and is documented at https://ipython.org/ipython-doc/dev/config/options/qtconsole.html. The only effective way I have found to disable it is by adding --IPythonWidget.enable_calltips=False as an argument to qtconsole that in turn an argument of ipython. A command line for all of this is:
ipython qtconsole --IPythonWidget.enable_calltips=False
I have verified this with IPython QTConsole 3.2.0 and believe it generally works for versions below 4, which I have not been able to install yet without breaking QTConsole. (I believe what some refer to as IPython 4 is also known as Jupyter 4. See below for information on Jupyter and disabling calltips in it.)
On Linux and Windows system, generating this command line can be automated using a bash alias. On Windows it can be automated by using it as the Target of an icon configured in its properties.
It is supposed to be possible to disable calltips by setting c.IPythonWidget.enable_calltips = False in the right configuraton file in which c = get_config() is set on the first line. I tried doing this on a Windows 7 system in ipython_qtconsole_config.py and ipython_config.py in ~.ipython\profile_default\ and several other locations, but could not get it to work.
Project Jupyter is the successor to the IPython project and began in 2014. Its website is http://jupyter.org and information about its Qt console is at http://jupyter.org/qtconsole/stable/index.html. In response to a question about disabling IPython calltips, which I submitted to https://github.com/ipython/ipython/issues, I received the following on how to disable calltips for Jupyter:
On the command line
jupyter qtconsole --JupyterWidget.enable_calltips=False
or add
c.JupyterWidget.enable_calltips = False
to
~/.jupyter/juptyer_qtconsole_config.py