Git Product home page Git Product logo

bpython's Introduction

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 occassion 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.

Features & Examples

  • In-line syntax highlighting. This uses Pygments for lexing the code as you type, and colours appropriately.
  • Readline-like autocomplete. Suggestions displayed as you type.
  • 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 code is re-evaluated.
  • Pastebin code/write to file. Use the <F8> key to upload the screen's contents to pastebin, with a URL returned.
  • Flush curses screen to stdout. When you quit bpython, the screen data will be flushed to stdout, so it basically looks the same as if you had quit the vanilla interpreter.

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
  • 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 followign 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.

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)

bpython's People

Contributors

acdha avatar afokau avatar akaptur avatar ambv avatar amjith avatar bobf avatar bragradon avatar eikehein avatar federicoceratto avatar hndrewaall avatar ikanobori avatar jasonlaster avatar jorgenpt avatar keyan avatar lohmataja avatar marienz avatar michaelmulley avatar mjzffr avatar mlauter avatar mmaker avatar myint avatar noelladsa avatar sebastinas avatar sharow avatar susinmotion avatar tarekziade avatar techtonik avatar thekthuser avatar thomasballinger avatar trundle avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

cloudxtreme

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.