About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

linux default iconkrpython Publisher's description

krpython - A fancy curses interface to the Python interactive interpreter

krpython - A fancy curses interface to the Python interactive interpreter

(apt-get install python-pyparsing python-pygments)

A few people asked for stuff like syntax highlighting
and autocomplete for the Python interactive interpreter.
IPython seems to offer this (plus you can get readline
behaviour in the vanilla interpreter) but I tried
IPython a couple of times. Perhaps I didn't really get
it, but I get the feeling that the ideas behind IPython
are pretty different to krpython. I didn't want to create
a whole development environment; I simply wanted to
provide a couple of neat features that 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 modern IDEs, but in a simple,
lightweight package that can be run in a terminal
window, so curses seemed like the best choice.
Sorry if you use Windows.

krpython doesn't attempt to create anything new or
groundbreaking, it simply brings 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 krpython now
whenever I would normally use the vanilla interpreter,
e.g. for testing out solutions to people's problems
on IRC, quickly testing a method of doing something
without creating a temporary file, etc..


* In-line syntax highlighting.
This uses Pygments for lexing the code as you type,
and colours appropriately. Pygments does a great job
of doing all of the tricky stuff and really leaving
me with very little to do except format the tokens
in all my favourite colours.

* Readline-like autocomplete with suggestions displayed
as you type.
Thanks to Python's readline interface to libreadline
and a ready-made class for using a Python interpreter's
scope as the dataset, the only work here was displaying
the readline matches as you type in a separate curses
window below/above the cursor.

* Expected parameter list.
As in a lot of modern IDEs, krpython 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,
which seems to be pretty adequate, but obviously
in some cases it's simply not possible. I used pyparsing
to cure my nested parentheses woes; again, it was
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 in memory and
when the Rewind function is called, the last line is
popped and the entire code is re-evaluated. As you can
imagine, this has a lot of potential problems, but for
defining classes and functions, I've found it to be
nothing but useful.

* Pastebin code/write to file.
I don't really use the save thing much, but the pastebin
thing's great. Hit a key and what you see on the screen
will be sent to a pastebin and a URL is returned for you
to do what you like with. I've hardcoded rafb.net/paste
in for now, that needs to be fixed so it's configurable.
Next release, I promise. Support for gist.github.com
was just added. Just add use_gist to your ~/.bpythorc
file, and you'll be pasting strait to Gists instead.

* 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 krpython,
the screen data will be flushed to stdout, so it basically
looks the same as if you had quit the vanilla interpreter.

See the sample-rc file for a list of available options.
You should save your rc file as ~/.krpythonrc or specify
at the command line:

krpython /path/to/krpythonrc

Known Bugs

* Triple quoted strings over multiple lines work, but they're
not highlighted properly.


System Requirements:

No special requirements.
Program Release Status:
Program Install Support: Install and Uninstall

krpython Tags:

Click on a tag to find related softwares

Is krpython your software?

Manage your software

Most Popular

linux default icon GDB 7.4
GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it... Read more
linux default icon Coral 0.9.1
Coral is a tool and a development platform to create and transform models and modeling languages.
linux default icon Forum Paid Plus Script 6.1
Forum Paid Pay Per Post Exchange is targeted at forum owners who wish to...
linux default icon sdo 0.6.5
Converts oracle SDO_GEOMETRY objects to WKT and GeoJSON.
linux default icon Get Paid Plus Script 6.1
Get Paid Plus Script

Related Category

» Other (877)
» Tools & Editors (359)
» Web Development (146)