Tab completion in IPython is practically unusable because the text is so difficult to read.
Here's what I've tried:
I didn't have an ipython configuration file so I created one:
ipython profile create.
In my ipython_config.py I set c.InteractiveShell.colors = 'NoColors'. That made all my text white but the completion text didn't change.
I'm using the following software:
kitty terminal: 0.14.1
IPython: 7.5.0
Pygments: 2.4.2
prompt-toolkit: 2.0.9
I found a solution. It seems my terminal is using 24bit color and that must be interacting poorly with the defaults of IPython which defaults to 256 colors. You can test your terminal with this command:
printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
If you see 'TRUECOLOR', then your terminal supports true color.
I set that in my ipython_config.py file: c.TerminalInteractiveShell.true_color = True. Now the completion text is readable.
Related
Recently VSCode got an update and after that my jupyter notebook interface has changed which created a lot of problems for me. Now I don't know how to run cell code line by line, etc.
Is there any other way to do so or how can I get back to an older version of the notebook?
Open the command palette (Ctrl+Shift+P on Windows, Cmd+Shift+P on Mac)
Type 'Preferences: Open Settings (JSON)' and select the first option to open your user settings.json file
Add the following line to your user settings.json file:
"jupyter.experiments.optOutFrom": ["NativeNotebookEditor"],
If the following entry is present in your user settings.json file, delete it:
"workbench.editorAssociations": [
{
"viewType": "jupyter-notebook",
"filenamePattern": "*.ipynb"
}
]
Reload Visual Studio Code for the new settings to take effect. You should be opted back into the old Jupyter notebook interface.
If you want to run a python script line by line using Jupyter interpreter this is the option you need to tick in VS code settings.
In v1.60 (see https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_60.md#jupyter):
VS Code now supports the Run By Line feature in Jupyter notebooks.
This is a simple debug mode that lets you execute the code of a cell
line by line. To try it out, just make sure that you have ipykernel v6+ installed as your selected kernel, then select the Run By Line
button.
Previously:
In vscode 1.59 (see https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_59.md#jupyter-run-by-line)
Jupyter "Run By Line"
We've been working on supporting the "Run By Line" feature in Jupyter
notebooks. This feature is essentially a simplified debug mode that
lets you step through your cell's code line by line without any
complex debug UI. This is still experimental, but you can try it out
by setting "jupyter.experimental.debugging": true, installing
version 6 of ipykernel in your selected kernel, then clicking the "Run
By Line" button in the cell toolbar.
"jupyter.experimental.debugging": true
In ipython the magic-command %edit opens the default text editor on microsoft windows. On window-7 this is notepad, a robust, but somewhat limited text editor.
I'd like to have started notedpad++ my favorite editor for scripting. I changed already the association of py/txt/ etc. files to notedpad++. Thus doubleclicking such files works well. Anyhow in ipython %edit still starts the notepad.exe.
Is there a way to change this configuration of ipython?
regards
olippuner
The %edit command will invoke the editor set in your environment as EDITOR. If this variable is not set, it will default to notepad under Windows.
You can also control the editor by setting TerminalInteractiveShell.editor in ipython_config.py.
Source: IPython documentation
The ionic shell tool uses colours by default which makes the output unreadable in a black-on-white console (KDE konsole on Ubuntu).
Is there an option to disable the colours, i.e. use the default text colour only?
If you look into the ionic sh you will see that they Using Node.js chalk.
you can start your command with parameters or set a global environment variable:
https://github.com/chalk/supports-color#info
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
I am using the IPython qtconsole and the directories are dark blue and I can't seem to find any way to change this in the theme. I'm using pygments with the monokai theme for the syntax highlighting.
This coloring is actually done by ls itself.
You can use the LSCOLORS ( on OS X / BSD, or LS_COLORS on Linux) environment variable to customize this.
Here is a nifty utility for generating an LSCOLORS value.
You can probably Google-about for peoples favored dark-background LSCOLORS values.
Then just set the variable, either in Python:
import os
os.environ['LSCOLORS'] = 'gxfxcxdxbxegedabagacad'
or in your shell session prior to launching IPython (or .bashrc, etc.):
$> export LSCOLORS=gxfxcxdxbxegedabagacad
$> ipython qtconsole
see also: reference docs for LS_COLORS