mypython

A Python REPL the way I like it

View on GitHub

mypython

A Python REPL the way I like it.

Build Status

What? Why?

I was unsatisfied with all the existing Python interpreter options. None quite worked the way I liked them to, even after attempting to configure them (often a frustrating experience).

So instead I wrote my own. Turns out it’s really easy.

prompt-toolkit is a nice framework for creating custom REPLs. It took under an hour to create a basic Python REPL, and only a few days to add most of the features I like to it. REPLs created with prompt-toolkit are really nice. They support advanced features like syntax highlighting, multiline editing, and popup tab completion without any additional work (unlike REPLs based on readline).

Features

And some other stuff that I haven’t implemented yet.

Most of this stuff either comes for free from prompt-toolkit or was really easy to implement, in some cases by modifying some code from other libraries (ptpython, ipython, sympy, the Python standard library).

Installation

I haven’t packaged it yet. For now you can clone the repo and run ./bin/mypython.

It requires the following packages, which can be installed from conda-forge:

Configuration

There is none. It’s already configured the way I like it.

Features and bugs and stuff

I wrote this for me. You can request features, submit PRs, and report bugs, but be aware that I won’t accept any PR unless it’s a feature I want. I’m really not designing this to be used by other people.

Acknowledgments

Thanks to Jonathan Slenders for prompt-toolkit and ptpython (which I borrowed some of the more tricky things like Python multiline and Jedi completion from). Basically all the fancy stuff here is coming from prompt-toolkit. I just combined it together into a REPL that I like. Thanks to the IPython guys for figuring out the matplotlib eventloop stuff (which I could never do on my own), and for inspiring many of the features I’ve implemented.

License

MIT.

Licenses for code taken and modified from ptpython, IPython, prompt-toolkit, SymPy, and the Python standard library are at the top of the respective files.