-
Notifications
You must be signed in to change notification settings - Fork 6
/
pyrepl.html
191 lines (187 loc) · 5.63 KB
/
pyrepl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html>
<head>
<title>~mwh/hacks/pyrepl</title>
<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>
<p class="header">
<<a href="../index.html">home</a>>
<<a href="../personal.html">personal</a>>
<hacks>
<<a href="../links.html">links</a>>
<<a href="../quotes.html">quotes</a>>
<<a href="../details.html">details</a>>
<<a href="../summaries/index.html">summaries</a>>
</p>
<p class="header" style="background-color: #dddddd">
<a href="../hacks/index.html">~mwh/hacks:</a>
<<a href="http://bytecodehacks.sourceforge.net/">bytecodehacks</a>>
<<a href="../hacks/xmms-py.html">xmms-py</a>>
<<a href="../hacks/pyicqlib.html">pyicqlib</a>>
<<a href="../hacks/pyrepl.html">pyrepl</a>>
</p>
<h1>pyrepl</h1>
<p>
For ages now, I've been working on and off on a replacement for
readline for use from Python. readline is undoubtedly great, but a
couple of things irritate me about it. One is the inability to do
sane multi-line editing. Have you ever typed something like:
</p>
<pre>
>>> for i in range(10):
... for i in range(10):
... print i*j
</pre>
<p>
into a Python top-level? Grr, that "i" on the second line should have
been a "j". Wouldn't it be nice if you could just press "up" on your
keyboard and fix it? This was one of the aims I kept in mind when
writing pyrepl (or pyrl as I used to call it, but that name's <a
href="http://www.algonet.se/~jsjogren/oscar/cython/">taken</a>).
</p>
<p>
Another irritation of readline is the GPL. I'm not even nearly as
anti-GPL as some, but I don't want to have to GPL my program just so I
can use readline.
</p>
<p>
0.7 adds to the version that runs an a terminal an experimental
version that runs in a pygame surface. A long term goal is
Mathematica-like notebooks, but that's a loong way off...
</p>
<p>
Anyway, after many months of intermittent toil I present:
</p>
<p style="font-size: larger; text-align: center">
<a href="pyrepl-0.7.2.tar.gz">pyrepl 0.7.2</a>
</p>
<p style="font-size: smaller; text-align: center">
(0.7.2 fixes a number of silly small typos and slips)
</p>
<p style="font-size: smaller; text-align: center">
(the significant change since 0.7 is inclusion of a working setup.py...)
</p>
<p>
<p style="text-align: center">
For more details on the changes since 0.6, you can read the <a href="pyrepl-CHANGES">CHANGES</a> file.
</p>
<p>
<span style="font-weight: bold">NEWS</span> (as of Dec 12 2002):
pyrepl now has dedicated <a
href="http://pyrepl.codespeak.net/mailman/listinfo/">mailing lists</a>
where discussion about pyrepl's development will take place.
</p>
<p>
Dependencies: Python 2.1 with the termios and curses modules built (I
don't really use curses, but I need the terminfo functions that live
in the curses module), or pygame installed (if you want to live on the
bleeding edge).
</p>
<p>
There are probably portability gremlins in some of the ioctl using
code. Fixes gratefully received!
</p>
<p>
Features:
</p>
<ul>
<li>
sane multi-line editing
</li>
<li>
history, with incremental search
</li>
<li>
completion, including displaying of available options
</li>
<li>
a fairly large subset of the readline emacs-mode key bindings (adding
more is mostly just a matter of typing)
</li>
<li>
Deliberately liberal, Python-style license
</li>
<li>
a new python top-level that I really like; possibly my favourite
feature I've yet added is the ability to type
<pre>
->> from __f
</pre>
and hit TAB to get
<pre>
->> from __future__
</pre>
then you type " import n" and hit tab again to get:
<pre>
->> from __future__ import nested_scopes
</pre>
(this is very addictive!).
</li>
<li>
no global variables, so you can run two independent
readers without having their histories interfering.
</li>
<li>
An experimental version that runs in a pygame surface.
</li>x
</ul>
<p>
pyrepl currently consists of four major classes:
</p>
<pre>
Reader <- HistoricalReader <- CompletingReader <- PythonReader
</pre>
<p>
There's also a <tt>UnixConsole</tt> class that handles the low-level
details.
</p>
<p>
Each of these lives in it's own file, and there are a bunch of support
files (including a C module that just provides a bit of a speed up -
building it is strictly optional).
</p>
<p>
IMHO, the best way to get a feel for how it works is to type
</p>
<pre>
$ python pythoni
</pre>
<p>
and just play around. If you're used to readline's emacs-mode, you
should feel right at home. One point that might confuse: because the
arrow keys are used to move up and down in the command currently being
edited, you need to use ^P and ^N to move through the history.
</p>
<p class="header">
<<a href="../index.html">home</a>>
<<a href="../personal.html">personal</a>>
<hacks>
<<a href="../links.html">links</a>>
<<a href="../quotes.html">quotes</a>>
<<a href="../details.html">details</a>>
<<a href="../summaries/index.html">summaries</a>>
</p>
<address>
<a href="http://validator.w3.org/check/referer">
<img class="w3link"
src="http://validator.w3.org/images/vxhtml10"
alt="Valid XHTML 1.0!" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img class="w3link"
src="http://jigsaw.w3.org/css-validator/images/vcss.gif"
alt="Valid CSS!" />
</a>
Last updated: $Date: 2002/12/12 11:52:29 $. Comments to <a
href="mailto:mwh@python.net">mwh@python.net</a>.
<br />
<a href="http://www.anybrowser.org/campaign/">
Best viewed with any browser</a>. Except netscape 4 with javascript
on...
</address>
</body>
</html>