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

bpython - A fancy curses interface to the Python interactive interpreter=======Dependencies============Pygments(apt-get install python-pygments)Introduction============A few people asked for stuff like syntax highlightingand autocomplete for the Python interactive interpreter.IPython seems to offer this (plus you can get readlinebehaviour in the vanilla interpreter) but I triedIPython a couple of times. Perhaps I didn't really getit, but I get the feeling that the ideas behind IPythonare pretty different to bpython. I didn't want to createa whole development environment; I simply wanted toprovide a couple of neat features that already existand turn them into something a little more interactive.The idea is to provide the user with all the featuresin-line, much like modern IDEs, 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 orgroundbreaking, it simply brings together a few neatideas and focuses on practicality and usefulness.For this reason, the "Rewind" function should betaken with a pinch of salt, but personally I havefound it to be very useful. I use bpython nowwhenever I would normally use the vanilla interpreter,e.g. for testing out solutions to people's problemson IRC, quickly testing a method of doing somethingwithout creating a temporary file, etc..I hope you find it useful and please feel free tosubmit any bugs/patches (yeah right)/suggestionsto:robertanthonyfarrell@gmail.comor place them at the bitbucket issue page for thisproject at:http://bitbucket.org/bobf/bpython/issues/For any other ways of communicating with bpythonusers and devs you can find us at the communicationpage on the projects homepage:http://www.noiseforfree.com/bpython/community.htmlHope to see you there!Features========* In-line syntax highlighting.This uses Pygments for lexing the code as you type,and colours appropriately. Pygments does a great jobof doing all of the tricky stuff and really leavingme with very little to do except format the tokensin all my favourite colours.* Readline-like autocomplete with suggestions displayedas you type.Thanks to Python's readline interface to libreadlineand a ready-made class for using a Python interpreter'sscope as the dataset, the only work here was displayingthe readline matches as you type in a separate curseswindow below/above the cursor.* Expected parameter list.As in a lot of modern IDEs, bpython will attempt todisplay a list of parameters for any function youcall. The inspect module is tried first, which workswith any Python function, and then pydoc if that fails,which seems to be pretty adequate, but obviouslyin some cases it's simply not possible. I used pyparsingto cure my nested parentheses woes; again, it wasnice and easy.* Rewind.I didn't call this "Undo" because I thought that wouldbe misleading, but "Rewind" is probably as bad. Theidea is that the code entered is kept in memory andwhen the Rewind function is called, the last line ispopped and the entire code is re-evaluated. As you canimagine, this has a lot of potential problems, but fordefining classes and functions, I've found it to benothing but useful.* Pastebin code/write to file.I don't really use the save thing much, but the pastebinthing's great. Hit a key and what you see on the screenwill be sent to a pastebin and a URL is returned for youto do what you like with. I've hardcoded paste.pocoo.orgin 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't personally recall a curses app that does this,perhaps it's often not useful, but when you quit bpython,the screen data will be flushed to stdout, so it basicallylooks 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 ~/.bpython/config or specifyat the command line:bpython -c /path/to/bpython/configKnown Bugs==========For known bugs please see bpython's issue tracker atbitbucket:http://bitbucket.org/bobf/bpython/issues/

About

bpython - A fancy curses interface to the Python interactive interpreter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors105

Languages


[8]ページ先頭

©2009-2025 Movatter.jp