Skip to main content
https://img.shields.io/pypi/v/bpython https://readthedocs.org/projects/bpython/badge/?version=latest https://img.shields.io/badge/code%20style-black-000000.svg

bpython: A fancy 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

Installation using Pip

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 (which works with any Python function) is tried first, 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

  • curtsies >= 0.4.0

  • greenlet

  • pyxdg

  • requests

  • Sphinx >= 1.5 (optional, for the documentation)

  • babel (optional, for internationalization)

  • jedi (optional, for experimental multiline completion)

  • watchdog (optional, for monitoring imported modules for changes)

  • pyperclip (optional, for copying to the clipboard)

bpython-urwid

bpython-urwid requires the following additional packages:

  • urwid

Installation via OS Package Manager

The majority of desktop computer operating systems come with package management systems. If you use one of these OSes, you can install bpython using the package manager.

Ubuntu/Debian

Ubuntu/Debian family Linux users can install bpython using the apt package manager, using the command with sudo privileges:

$ apt install bpython

In case you are using an older version, run

$ apt-get install bpython

Arch Linux

Arch Linux uses pacman as the default package manager; you can use it to install bpython:

$ pacman -S bpython

Fedora

Fedora users can install bpython directly from the command line using dnf.

$ dnf install bpython

GNU Guix

Guix users can install bpython on any GNU/Linux distribution directly from the command line:

$ guix install bpython

macOS

macOS does not include a package manager by default. If you have installed any third-party package manager like MacPorts, you can install it via

$ sudo port install py-bpython

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!

Release files for bpython 0.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bpython 0.26
File Size Uploaded
bpython-0.26.tar.gz 207.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bpython 0.26
File Interpreter ABI Platform
bpython-0.26-py3-none-any.whl Python 3 none any Details

Total release size: 383.6 kB

Release files / bpython-0.26.tar.gz

Download URL bpython-0.26.tar.gz
Size 207.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f79083e1e3723be9b49c9994ad1dd3a19ccb4d0d4f9a6f5b3a73bef8bc327433
BLAKE2b-256 checksum
How to use checksums
4429cd80e9108a6fc6a925ffb915f8f69198a2bb2388e39167a41d743ac2a8f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / bpython-0.26-py3-none-any.whl

Download URL bpython-0.26-py3-none-any.whl
Size 176.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91bdbbe667078677dc6b236493fc03e47a04cd099630a32ca3f72d6d49b71e20
BLAKE2b-256 checksum
How to use checksums
ea9226d8d98de4c1676305e03ec2be67850afaf883b507bf71b917d852585ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.26 This release

2 release files

0.25

2 release files

0.24

2 release files

0.23

2 release files

0.22

2 release files

0.21

2 release files

0.20.1

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17.1

2 release files

0.17

2 release files

0.16

2 release files

0.15

1 release file

0.14.2

1 release file

0.14

1 release file

0.13.2

1 release file

0.13.1

1 release file

0.13

1 release file

0.12

1 release file

0.11

1 release file

0.10.1

1 release file

0.10

0.9.7.1

0.9.7

0.9.6.2

0.9.6

0.9.5.2

0.9.5.1

0.9.4

0.9.3

0.9.2

0.9.1

0.9.0

0.7.1

2 release files

0.9.6.1gg

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page