Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpython - A fancy curses interface to the Python interactive interpreter

License

NotificationsYou must be signed in to change notification settings

bpython/bpython

 
 

Repository files navigation

https://img.shields.io/pypi/v/bpythonhttps://travis-ci.org/bpython/bpython.svg?branch=masterhttps://readthedocs.org/projects/pinnwand/badge/?version=latest

bpython: A fancy curses interface to the Python interactive interpreter

bpython is a lightweight Python interpreter that adds several features commonto IDEs. These features includesyntax highlighting,expected parameterlist,auto-indentation, andautocompletion. (See below for exampleusage).

bpython

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

bpython is a great replacement to any occasion where you would normally use thevanilla 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 - includingfull documentation - at ourhomepage.

Installation & Basic Usage

If you havepip installed, you can simply run:

$ pip install bpython

Start bpython by typingbpython in your terminal. You can exit bpython byusing theexit() command or by pressing control-D like regular interactivePython.

Features & Examples

  • Readline-like autocomplete, with suggestions displayed as you type.
  • In-line syntax highlighting. This uses Pygments for lexing the code as youtype, and colours appropriately.
  • Expected parameter list. As in a lot of modern IDEs, bpython will attempt todisplay a list of parameters for any function you call. The inspect module istried first, which works with any Python function, and then pydoc if thatfails.
  • 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 andwhen the Rewind function is called, the last line is popped and the entiresession is re-evaluated. Use <control-R> to rewind.
  • Edit the current line or your entire session in an editor. F7 opens the currentsession in a text editor, and if modifications are made, the session is rerunwith these changes.
  • Pastebin code/write to file. Use the <F8> key to upload the screen's contentsto pastebin, with a URL returned.
  • Reload imported Python modules. Use <F6> to clear sys.modules and rerun yoursession 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 saveyour 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 alsorequired:

  • requests[security]

cffi

If you have problems installing cffi, which is needed by OpenSSL, please take alook atcffi docs.

bpython-urwid

bpython-urwid requires the following additional packages:

  • urwid

Known Bugs

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

Contact & Contributing

I hope you find it useful and please feel free to submit any bugs/patchessuggestions toRobert or place them on the GitHubissues tracker.

For any other ways of communicating with bpython users and devs you can find usat the community page on theproject homepage, or in thecommunity.

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 thecolours)

Alternatives

ptpython

IPython

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

About

bpython - A fancy curses interface to the Python interactive interpreter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp