LinuxCommandLibrary

bpython

Interactive Python interpreter with autocompletion

TLDR

Start a REPL (interactive shell)

$ bpython
copy

Execute a specific Python file
$ bpython [path/to/file.py]
copy

Execute a specific Python file and start a REPL
$ bpython [[-i|--interactive]] [path/to/file.py]
copy

Use the specified configuration file instead of the default configuration
$ bpython --config [path/to/file.conf]
copy

SYNOPSIS

bpython [options] [filename]

PARAMETERS

-h, --help
    Show help message and exit

-q, --quiet
    Suppress startup banner

-c CMD, --command=CMD
    Execute command before interactive mode

-i
    Run script interactively after execution

-x
    Ignore ~/.bpythonrc configuration

--config=FILE
    Use alternative config file

--debug
    Print debug information

DESCRIPTION

bpython is a curses-based interactive Python interpreter that significantly improves the standard REPL experience. It offers syntax highlighting, auto-completion with real-time suggestions, a sidebar for editing completions, and support for multi-line editing. Users can introspect objects using ? and ?? operators, similar to IPython. It supports running scripts interactively with the -i flag and executing commands before entering interactive mode via -c. The interface is lightweight, using only the standard library's curses module (or urwid backend optionally). bpython remembers history across sessions via readline integration and provides mouse support in compatible terminals. Ideal for quick scripting and learning, it boosts productivity without the overhead of heavier alternatives like IPython. Configuration is via ~/.bpythonrc, allowing customization of colors, keybindings, and features.

CAVEATS

Requires a terminal with curses support; limited to Python 3.7+; no Jupyter integration.

KEY FEATURES

Syntax highlighting
Editable autocomplete sidebar
Object introspection (?/??)
Multi-line paste support
Configurable keybindings

INSTALLATION

Via pip: pip install bpython
Or package manager: apt install bpython (Debian/Ubuntu)

HISTORY

Created by Bob Farrell in 2008; first release in 2009. Actively maintained on GitHub, with ongoing Python 3 compatibility updates and feature enhancements like async support.

SEE ALSO

python(1), ipython(1), ptpython(1)

Copied to clipboard