The Wayback Machine - https://web.archive.org/web/20190425083950/https://github.com/bpython/bpython
Skip to content
bpython - A fancy curses interface to the Python interactive interpreter
Branch: master
Clone or download
Latest commit 06382d9 Apr 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bpdb Fix compatibility with 2.7 Mar 4, 2018
bpython Catch function signature inspection errors for built-in types Apr 2, 2019
data Adapt desktop and appdata files to new spec Mar 4, 2018
doc/sphinx Require >= 3.4 for Python 3.x Feb 13, 2018
.gitignore
.pycheckrc First hg commit after moving from git: added dark magic to prevent Apr 9, 2009
.travis.install.sh Fix typo Jan 10, 2017
.travis.script.sh Missing semi-colons Jan 18, 2015
.travis.yml travis: remove 3.7 from allowed_failures Nov 27, 2018
AUTHORS Use AUTHORS in authors.rst Feb 10, 2015
CHANGELOG Update changelog Apr 2, 2019
LICENSE Replace copied code with original code Dec 14, 2015
MANIFEST.in Fix paths Mar 4, 2018
README.rst
light.theme Fixed 341 right arrow suggestion color Sep 3, 2014
requirements.txt Update requirements Jan 10, 2017
sample.theme
setup.cfg Build wheel Feb 19, 2015
setup.py Adapt desktop and appdata files to new spec Mar 4, 2018
windows.theme Added support to run bpython cli in Windows CMD Jul 14, 2011

README.rst

ImageLink

bpython: A fancy curses interface to the Python interactive interpreter

bpython is a lightweight Python interpreter that adds several features common to IDEs. These features include syntax highlighting, expected parameter list, auto-indentation, and autocompletion. (See below for example usage).

bpython

bpython does not aim to be a complete IDE - the focus is on implementing a few ideas in a practical, useful, and lightweight manner.

bpython is a great replacement to any occasion where you would normally use the vanilla Python interpreter - testing out solutions to people's problems on IRC, quickly testing a method of doing something without creating a temporary file, etc..

You can find more about bpython - including full documentation - at our homepage.

Installation & Basic Usage

If you have pip installed, you can simply run:

$ pip install bpython

Start bpython by typing bpython in your terminal. You can exit bpython by using the exit() command or by pressing control-D like regular interactive Python.

Features & Examples

  • Readline-like autocomplete, with suggestions displayed as you type.
  • In-line syntax highlighting. This uses Pygments for lexing the code as you type, and colours appropriately.
  • Expected parameter list. As in a lot of modern IDEs, bpython will attempt to display a list of parameters for any function you call. The inspect module is tried first, which works with any Python function, and then pydoc if that fails.
  • Rewind. This isn't called "Undo" because it would be misleading, but "Rewind" is probably as bad. The idea is that the code entered is kept in memory and when the Rewind function is called, the last line is popped and the entire session is re-evaluated. Use <control-R> to rewind.
  • Edit the current line or your entire session in an editor. F7 opens the current session in a text editor, and if modifications are made, the session is rerun with these changes.
  • Pastebin code/write to file. Use the <F8> key to upload the screen's contents to pastebin, with a URL returned.
  • Reload imported Python modules. Use <F6> to clear sys.modules and rerun your session to test changes to code in a module you're working on.

Configuration

See the sample-config file for a list of available options. You should save your config file as ~/.config/bpython/config (i.e. $XDG_CONFIG_HOME/bpython/config) or specify at the command line:

bpython --config /path/to/bpython/config

Dependencies

  • Pygments
  • requests
  • curtsies >= 0.1.18
  • greenlet
  • six >= 1.5
  • Sphinx != 1.1.2 (optional, for the documentation)
  • mock (optional, for the testsuite)
  • babel (optional, for internationalization)
  • watchdog (optional, for monitoring imported modules for changes)
  • jedi (optional, for experimental multiline completion)

Python 2 before 2.7.7

If you are using Python 2 before 2.7.7, the following dependency is also required:

  • requests[security]

cffi

If you have problems installing cffi, which is needed by OpenSSL, please take a look at cffi docs.

bpython-urwid

bpython-urwid requires the following additional packages:

  • urwid

Known Bugs

For known bugs please see bpython's known issues and FAQ page.

Contact & Contributing

I hope you find it useful and please feel free to submit any bugs/patches suggestions to Robert or place them on the GitHub issues tracker.

For any other ways of communicating with bpython users and devs you can find us at the community page on the project homepage, or in the community.

Hope to see you there!

CLI Windows Support

Dependencies

Curses Use the appropriate version compiled by Christoph Gohlke.

pyreadline Use the version in the cheeseshop.

Recommended

Obtain the less program from GnuUtils. This makes the pager work as intended. It can be obtained from cygwin or GnuWin32 or msys

Current version is tested with

  • Curses 2.2
  • pyreadline 1.7

Curses Notes

The curses used has a bug where the colours are displayed incorrectly:

  • red is swapped with blue
  • cyan is swapped with yellow

To correct this I have provided a windows.theme file.

This curses implementation has 16 colors (dark and light versions of the colours)

Alternatives

ptpython

IPython

Feel free to get in touch if you know of any other alternatives that people may be interested to try.

You can’t perform that action at this time.