Code Monkey home page Code Monkey logo

richprompt's Introduction

rich-ipyprompt

A better prompt for IPython interactive shell.

Features

  • Adds the current path if it changes from the default
  • Replaces the less useful In[x]: prompt (we keep the Out[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).

Quickstart

To easily get the theme installed and loading at startup:

pip install richprompt[hook]
python -m ipython_startup_hook.install

Installation

Install using pip:

pip install richprompt 

or with conda:

conda install -c lewisacidic richprompt

Usage

Load the prompt with IPython magic:

%load_ext richprompt

To set the prompt back to what you had previously:

%unload_ext richprompt

Running this at startup

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.

Development

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

richprompt's People

Contributors

lewisacidic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.