A better prompt for IPython interactive shell.
- Adds the current path if it changes from the default
- Replaces the less useful
In[x]:
prompt (we keep theOut[x]
, which you are more likely to want to reference) with the classic>>>
. - Formats the vi mode nicely if vi mode is set
- Adds the execution time for the previous command if above a minimum delta (by default 5).
To easily get the theme installed and loading at startup:
pip install richprompt[hook]
python -m ipython_startup_hook.install
Install using pip
:
pip install richprompt
or with conda
:
conda install -c lewisacidic richprompt
Load the prompt with IPython magic:
%load_ext richprompt
To set the prompt back to what you had previously:
%unload_ext richprompt
You can either put the following snippet in your IPython startup directory (usually $HOME/.ipython/profile_default/startup
):
try:
from richprompt.startup import load
load()
del load # don't pollute global namespace!!
except ModuleNotFoundError:
pass
Or use ipython-startup-hook
(recommended if you use IPython within virtual or conda environments).
This may be done at install with the command given in the Quickstart.
Create the conda environment:
conda env create -f envs/dev.yml
conda activate richprompt-dev
Format code by running the pre-commit tasks:
pre-commit run --all
Run the tests with pytest (note we need to use ipython
rather than python
for these tests as we need the IPython runtime):
ipython -m pytest