Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork252
bpython - A fancy curses interface to the Python interactive interpreter
License
bpython/bpython
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Pygments(apt-get install python-pygments)Sphinx != 1.1.2 (for the documentation only)(apt-get install python-sphinx)
A few people asked for stuff like syntax highlighting and autocomplete for thePython interactive interpreter. IPython seems to offer this (plus you can getreadline behaviour in the vanilla interpreter) but I tried IPython a couple oftimes. Perhaps I didn't really get it, but I get the feeling that the ideasbehind IPython are pretty different to bpython. I didn't want to create a wholedevelopment environment; I simply wanted to provide a couple of neat featuresthat already exist and turn them into something a little more interactive.
The idea is to provide the user with all the features in-line, much like modernIDEs, but in a simple, lightweight package that can be run in a terminalwindow, so curses seemed like the best choice. Sorry if you use Windows.
bpython doesn't attempt to create anything new or groundbreaking, it simplybrings together a few neat ideas and focuses on practicality and usefulness.For this reason, the "Rewind" function should be taken with a pinch of salt,but personally I have found it to be very useful. I use bpython now whenever Iwould normally use the vanilla interpreter, e.g. for testing out solutions topeople's problems on IRC, quickly testing a method of doing something withoutcreating a temporary file, etc..
I hope you find it useful and please feel free to submit any bugs/patches (yeahright)/suggestions to:robertanthonyfarrell@gmail.comor place them at the bitbucket issue page for this project at:http://bitbucket.org/bobf/bpython/issues/
For any other ways of communicating with bpython users and devs you can find usat the communication page on the projects homepage:http://bpython-interpreter.org/community
Hope to see you there!
- In-line syntax highlighting.
- This uses Pygments for lexing the code as you type, and coloursappropriately. Pygments does a great job of doing all of the tricky stuffand really leaving me with very little to do except format the tokens inall my favourite colours.
- Readline-like autocomplete with suggestions displayed as you type.
- Thanks to Python's readline interface to libreadline and a ready-made classfor using a Python interpreter's scope as the dataset, the only work herewas displaying the readline matches as you type in a separate curses windowbelow/above the cursor.
- Expected parameter list.
- As in a lot of modern IDEs, bpython will attempt to display a list ofparameters for any function you call. The inspect module is tried first,which works with any Python function, and then pydoc if that fails, whichseems to be pretty adequate, but obviously in some cases it's simply notpossible. I used pyparsing to cure my nested parentheses woes; again, itwas nice and easy.
- Rewind.
- I didn't call this "Undo" because I thought that would be misleading, but"Rewind" is probably as bad. The idea is that the code entered is kept inmemory and when the Rewind function is called, the last line is popped andthe entire code is re-evaluated. As you can imagine, this has a lot ofpotential problems, but for defining classes and functions, I've found itto be nothing but useful.
- Pastebin code/write to file.
- I don't really use the save thing much, but the pastebin thing's great. Hita key and what you see on the screen will be sent to a pastebin and a URLis returned for you to do what you like with. I've hardcodedpaste.pocoo.org in for now, that needs to be fixed so it's configurable.Next release, I promise.
- Flush curses screen to stdout.
- A featurette, perhaps, but I thought it was worth noting. I can'tpersonally recall a curses app that does this, perhaps it's often notuseful, but when you quit bpython, the screen data will be flushed tostdout, so it basically looks the same as if you had quit the vanillainterpreter.
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
For known bugs please see bpython's issue tracker at bitbucket:
http://bitbucket.org/bobf/bpython/issues/
- Curses
- Use the appropriate version compiled by Christoph Gohlkehttp://www.lfd.uci.edu/~gohlke/pythonlibs/
- pyreadline
- Use the version in the cheeseshophttp://pypi.python.org/pypi/pyreadline/
Obtain the less program from GnuUtils. This makes the pager work as intended.It can be obtained from cygwin or GnuWin32 or msys
- Curses 2.2
- pyreadline 1.7
- 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 my windows.theme file.
This curses implementation has 16 colors (dark and light versions of thecolours)
About
bpython - A fancy curses interface to the Python interactive interpreter
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.