
Bpython is a fancy interface to the Python interpreter - llambda
http://bpython-interpreter.org/
======
sho_hn
I love that the website has an "Alternatives" section linking to competitors.
That's not only classy, it also communicates confidence and inspires trust.

------
amjith
Pycon lightning talk about bpython:

[http://www.youtube.com/watch?feature=player_detailpage&v...](http://www.youtube.com/watch?feature=player_detailpage&v=N4zdWLuSbV0#t=643s)

~~~
tyler_ball
Starts at 10:45

------
vladev
I've used _bpython_ a lot in the past - mostly for it's instant syntax
highlight and autocompletion, but I recently discovered _ipython qtconsole_
and I can say it's much better (yes, it's not in the console, but I'm ok with
that). Its syntax highlighting is as good as bpython's, but allows me to use
it like a text editor and go up a few lines, edit, execute. Bpython cannot do
that.

Also, bpython is a bit buggy when it comes to pasting about a page worth of
code/string. In the nice case the syntax highlight gets confused. In the not
so nice - it becomes completely unusable, so that I have to kill it.

~~~
k_bx
Yeah. And I use ipython's %ed command for that kind of long scripts
(emacsclient as editor). Also really great feature.

------
joshbaptiste
Heh, The overall sentiment in irc freenode #python is a general dislike of
ipython and a recommendation of bypthon as a good alternative to the REPL.
It's a pretty light alternative but I still generally use ipython these days.

~~~
vasco
When I saw ipython for the first time I was really excited but now I realize I
never actually use it. Any thoughts about why it isn't appreciated?

~~~
dbecker
I think ipython is widely appreciated in the scientific/numeric python
community.

~~~
kenko
This seems right to me. ipython also has some features that go way beyond
enhancements to the REPL.

------
Derbasti
This is something I always loved about Python (as compared to other
languages): There are several awesome interpreters available for it!

This one has a curses-based interactive GUI for docs and autocompletion.

IPython has this awesome qtconsole that can show matplotlib plots inline with
the code. Then there is its HTML notebook which is probably awesome for
presenting stuff.

Even IDLE is pretty cool, actually.

Is stuff like this available for other programming languages? I know Matlab
has something vaguely similar to IPython and I think the IPython notebook is
inspired by mathematica?

In comparison IRB seems really boring to me. Does Ruby have a cool
interpreter? Perl? R?

~~~
masklinn
> Does Ruby have a cool interpreter?

I don't know if it's cool, but I know of at least one alternative to irb:
<http://pry.github.com/>

~~~
jvoorhis
Pry is pretty cool. It adds some debugger-like features and editor
integration, adds some convenient built-in commands, and improves on the UI in
similar ways to bpython.

------
xtacy
I really like the "instant" auto-completion. Can someone throw light on how it
was done?

~~~
btn
The code that generates the completions [1] and displays them [2] is fairly
simple. It uses a mix of scanning for a function's docstring, Python's built-
in rlcompleter module [3] to generate the possible identifiers and keywords,
its own module scanner for imports [4].

[1]
[https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/...](https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/repl.py#cl-583)

[2]
[https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/...](https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/cli.py#cl-409)

[3] <http://docs.python.org/library/rlcompleter.html>

[4]
[https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/...](https://bitbucket.org/bobf/bpython/src/2b3fb2cb6500/bpython/importcompletion.py)

~~~
xtacy
That's very useful. I wish shells like bash/zsh had this instant auto-
completion!

------
glesica
I've been aware of this for awhile but this prompted me to play with it.
Killer feature for me: it can be easily installed inside a virtualenv. This is
not (last I checked) possible with ipython.

~~~
sambe
I have had good experiences with ipython inside virtualenv, what's the
problem?

~~~
glesica
Just that "pip install ipython" has never worked properly for me when I'm
inside an virtuelenv. I just tried it and it worked, so maybe the problem was
fixed in the year or two since I last tried it, or maybe I was broken but have
been fixed in the last couple years...

~~~
slewis
You have to "easy_install readline" into your virtualenv along with "pip
install ipython" to get ipython's control characters working (otherwise
ipython outputs what looks like garbled text). readline is easy_install'd
rather than pip'd to because easy_install'd libs end up at the head of
sys.path.

~~~
tbatterii
i thought you only needed to do that on a mac, on linux it seems to work fine
with pip install ipython

~~~
takluyver
Yes, that's right. On Linux, you already have readline installed. But neither
Macs nor IPython can ship with readline itself, because of the GPL, so by
default you get the inferior libedit.

The Qt console doesn't require readline, but it does require Qt (and zeromq,
and pygments).

------
k_bx
Offtopic: with all these ipython/bpython's only thing that bugs me is need to
do pip install -U ipython bpython (which downloads significant portion of
bytes) in every virtualenv. I wonder if there's something like "pip install -U
ipython --local-cache" option to copy existing ipython inside this virtualenv.

~~~
urschrei
There is: [http://stackoverflow.com/questions/4806448/how-do-i-
install-...](http://stackoverflow.com/questions/4806448/how-do-i-install-from-
a-local-cache-with-pip)

~~~
k_bx
Wow, thanks a lot! I wonder why it's not in default somewhere.

------
leephillips
This is really nice, but if you use vim you can use ScreenShell, which lets
you execute parts of your buffer in a python interpreter (also works with lisp
and any other language with a REPL). So you already have syntax coloring,
completion, tags, etc.

------
superdude
FYI for Windows users..."pip install bpython" won't work. You must install the
Curses binary. I suggest from here:
<http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses>

~~~
bobfarrell
I didn't know about this - we actually have a GTK version that needs some
tidying up and packaging before we actually release it (if anyone is
interested in helping with this that would be great as none of us use Windows
- see the bpython website for details on how to get involved).

Could you possibly drop me an email or get me on IRC (again, see website for
details) to let me know how this curses binary works on Windows ? It'd be
great to add some documentation to the bpython site on this.

------
Aissen
I installed bpython, but found it to be much more CPU intensive than ipython,
for working on small machines (like a raspberry pi). Of course it's not a
problem if you have a reasonnably decent hardware.

Edit: setting auto_display_list to False in ~/.bpython/config (not XDG
compliant directory :( ) helps a lot. You can then use completion only when
you need it.

------
eddie_the_head
This looks very nice, but you'll notice the Arabic unicode sample is rendering
left-to-right, as almost all terminals currently are. I haven't seen any
terminal beyond right-to-left specific ones that support proper Arabic yet :/

~~~
hasenj
You're complainimg to the wrong audience.

I rarely need Arabic bidi support in a shell, and if I do, I tend to copy
paste from a proper text editor.

~~~
eddie_the_head
Yes, I agree but I don't do any Arabic editing in terminal. The only time I
bump up against this problem is when in Arabic IRC channels with irssi, and
all the letters are separated and backwards. I usually switch to IRCCloud's
web IRC when I'm chatting in Arabic channels anyways.

~~~
sho_hn
Over at Konversation, we implemented our bidi text behavior with the help of
KDE's Arabic and Hebrew translators. Not only do we render the words correctly
RTL, we also switch the overall directionality of the line based on the
implied direction of the majority of characters within it, i.e. a line
containing predominantly Arabic will be aligned to the right of the window
with the nickname to the right of the message. This makes it rather pleasant
to use for Arabic channels.

Edit: And I should mention that to my knowledge, KDE's terminal emulator
Konsole will render Arabic text correctly as well. However irssi would need to
do the alignment part.

------
cool-RR
What would make me use this is a way to get Django to use it when you launch
`manage.py shell`, similarly to ipython.

One advantage over ipython I see here is that it doesn't use sqlite (I think),
so it might run on Heroku.

~~~
cool-RR
Update: Django uses `bpython` by default if `ipython` isn't installed! Woohoo!

~~~
bobfarrell
Yeah, I don't use Django so I never did this myself, but somebody kindly did
the work for us. :)

------
jisaacstone
using bpython has encouraged me to write more docstrings, which I previously
did not do so much for personal projects ...

(because they are right there in the interpreter)

------
dustingetz
is there a good emacs-mode for python that gives interactive development of
the same level as inferior-lisp[1]? the python-modes i've seen only let you
re-execute a file, but not a buffer or expression.

inferior-lisp makes all the problems bpython is trying to solve, irrelevant.

[1] example: <http://vimeo.com/22798433> (4 mins)

~~~
ramanujan
I patched python-mode to do this (also did something similar for node and a
few other interpreters). Main thing is to add a "py-execute-line" routine and
a few others as wrappers around the file execution code. If there's interest,
might post as open source.

EDIT: here is a snippet

    
    
      (defun py-execute-line (&optional async)
        "Send the current line to the inferior python process using py-execute-region."
        (interactive "P")
        (save-excursion
          (end-of-line)
          (let ((end (point)))
            (beginning-of-line)
            (py-execute-region (point) end async)))
      )
    

That's the py-execute-line function, which is sending code to py-execute-
region defined in python-mode ([http://bazaar.launchpad.net/~python-mode-
devs/python-mode/py...](http://bazaar.launchpad.net/~python-mode-devs/python-
mode/python-mode/view/head:/python-mode.el#L7828)).

For some reason the default python mode in emacs is python.el rather than
python-mode.el. So you probably want to start by using python-mode.

------
tripzilch
Does BPython play nice with matplotlib/pylab yet? Last time I was very
impressed with its functionality, but I could get it to draw a graph properly.

Fortunately, IPython, especially with the new --qtconsole, is also very _very_
good.

------
krupan
I'll switch to bpython when it gets all the readline shortcuts that I use
without even thinking (like alt-b, alt-f, alt-backspace, ctrl-c, etc.).

~~~
bobfarrell
The worst thing is it's been at least two years since somebody first asked
about this and we still haven't done it, even though it's really, really easy.
:) I'll try to get this done soon if anybody is willing.

------
geirr
I really like this: Add "import bpdb; bpdb.set_trace()" to your code, and from
pdb type 'B' to drop into bpython.

------
plainOldText
Hmm, not bad. Actually, not bad at all. Very intuitive. I wish you could
change the theme color though.

~~~
amjith
Yes you can change the colors. <http://docs.bpython-
interpreter.org/themes.html>

~~~
pconf
There doesn't seem to be a color theme that works with a standard black on
white xterm. All of the defaults seem to be designed for Windows' white on
black... Even defining 'prompt = k' (where 'k' is black) produces a nearly
invisible grey prompt. Thanks but no thanks, I'll stick with vi/vim.

~~~
andreasvc
Terminals have had a black background since monitors first appeared. This
makes sense because a monitor bombards you with light and having a black
background minimizes the amount of light you're exposed to, and thus fatigue
(looking into a monitor is essentially looking into a lamp). I suppose the
first window managers later reversed this with white as the default
background; perhaps this has to do with the idea of a desktop metaphor where
white backgrounds mirror the typical color of paper, who knows.

Note that the tradition is not white on black, but gray on black, because the
former has too much contrast which gives it a kind of afterglow effect.
Monochrome monitors used to support only a single color, such as blue, orange
or green. That's why green on black now has (IMHO silly) "retro" connotations.

------
sdfjkl
This is nice for just exploring Python (and modules).

------
krob
this is awesome.

~~~
mcnemesis
just got me ipython (a ~few minutes back), and bpython (like a ~minute back),
and this feels damn awesome! I mean bpython!

