2
2
3
3
.. |ImageLink | image :: https://travis-ci.org/bpython/bpython.svg?branch=master
4
4
.. _ImageLink : https://travis-ci.org/bpython/bpython
5
- bpython - A fancy curses interface to the Python interactive interpreter
6
- ========================================================================
7
5
6
+ ***********************************************************************
7
+ bpython: A fancy curses interface to the Python interactive interpreter
8
+ ***********************************************************************
9
+
10
+ `bpython `_ is a lightweight Python interpreter that adds several features common
11
+ to IDEs. These features include **syntax highlighting **, **expected parameter
12
+ list **, **auto-indentation **, and **autocompletion **. (See below for example
13
+ usage).
14
+
15
+ .. image :: http://i.imgur.com/jf8mCtP.gif
16
+ :alt: bpython
17
+ :width: 646
18
+ :height: 300
19
+ :align: center
20
+
21
+ bpython does **not ** aim to be a complete IDE - the focus is on implementing a
22
+ few ideas in a practical, useful, and lightweight manner.
23
+
24
+ bpython is a great replacement to any occassion where you would normally use the
25
+ vanilla Python interpreter - testing out solutions to people's problems on IRC,
26
+ quickly testing a method of doing something without creating a temporary file,
27
+ etc..
28
+
29
+ You can find more about bpython - including `full documentation `_ - at our
30
+ `homepage `_.
31
+
32
+ .. contents ::
33
+ :local:
34
+ :depth: 1
35
+ :backlinks: none
36
+
37
+ ==========================
38
+ Installation & Basic Usage
39
+ ==========================
40
+ If you have `pip `_ installed, you can simply run:
41
+
42
+ .. code-block :: bash
43
+
44
+ $ pip install bpython
45
+
46
+ Start bpython by typing ``bpython `` in your terminal. You can exit bpython by
47
+ using the ``exit() `` command.
48
+
49
+ ===================
50
+ Features & Examples
51
+ ===================
52
+ * In-line syntax highlighting. This uses Pygments for lexing the code as you
53
+ type, and colours appropriately.
54
+
55
+ * Readline-like autocomplete. Suggestions displayed as you type.
56
+
57
+ * Expected parameter list. As in a lot of modern IDEs, bpython will attempt to
58
+ display a list of parameters for any function you call. The inspect module is
59
+ tried first, which works with any Python function, and then pydoc if that
60
+ fails.
61
+
62
+ * Rewind. This isn't called "Undo" because it would be misleading, but "Rewind"
63
+ is probably as bad. The idea is that the code entered is kept in memory and
64
+ when the Rewind function is called, the last line is popped and the entire
65
+ code is re-evaluated.
66
+
67
+ * Pastebin code/write to file. Use the <F8> key to upload the screen's contents
68
+ to pastebin, with a URL returned.
69
+
70
+ * Flush curses screen to stdout. When you quit bpython, the screen data will be
71
+ flushed to stdout, so it basically looks the same as if you had quit the
72
+ vanilla interpreter.
73
+
74
+ =============
75
+ Configuration
76
+ =============
77
+ See the sample-config file for a list of available options. You should save
78
+ your config file as **~/.config/bpython/config ** (i.e
79
+ ``$XDG_CONFIG_HOME/bpython/config ``) or specify at the command line::
80
+
81
+ bpython --config /path/to/bpython/config
82
+
83
+ ============
8
84
Dependencies
9
85
============
10
-
11
86
* Pygments
12
87
* requests
13
88
* curtsies >= 0.1.18
@@ -18,155 +93,84 @@ Dependencies
18
93
* watchdog (optional, for monitoring imported modules for changes)
19
94
* jedi (optional, for experimental multiline completion)
20
95
21
- If you are using Python 2 before 2.7.7, the following dependency is also
96
+ Python 2 before 2.7.7
97
+ ---------------------
98
+ If you are using Python 2 before 2.7.7, the followign dependency is also
22
99
required:
23
100
24
101
* requests[security]
25
102
26
- If you have problems installing cffi which is needed by pyOpenSSL,
27
- please take a look at https://cffi.readthedocs.org/en/release-0.8/#macos-x.
28
-
103
+ cffi
104
+ ----
105
+ If you have problems installing cffi, which is needed by OpenSSL, please take a
106
+ look at `cffi docs `_.
29
107
30
108
bpython-urwid
31
109
-------------
32
110
``bpython-urwid `` requires the following additional packages:
33
111
34
112
* urwid
35
113
36
- Introduction
37
- ============
38
- A few people asked for stuff like syntax highlighting and autocomplete for the
39
- Python interactive interpreter. IPython seems to offer this (plus you can get
40
- readline behaviour in the vanilla interpreter) but I tried IPython a couple of
41
- times. Perhaps I didn't really get it, but I get the feeling that the ideas
42
- behind IPython are pretty different to bpython. I didn't want to create a whole
43
- development environment; I simply wanted to provide a couple of neat features
44
- that already exist and turn them into something a little more interactive.
45
-
46
- The idea is to provide the user with all the features in-line, much like modern
47
- IDEs, but in a simple, lightweight package that can be run in a terminal
48
- window, so curses seemed like the best choice. Sorry if you use Windows.
49
-
50
- bpython doesn't attempt to create anything new or groundbreaking, it simply
51
- brings together a few neat ideas and focuses on practicality and usefulness.
52
- For this reason, the "Rewind" function should be taken with a pinch of salt,
53
- but personally I have found it to be very useful. I use bpython now whenever I
54
- would normally use the vanilla interpreter, e.g. for testing out solutions to
55
- people's problems on IRC, quickly testing a method of doing something without
56
- creating a temporary file, etc..
57
-
58
- I hope you find it useful and please feel free to submit any bugs/patches (yeah
59
- right)/suggestions to:
60
- robertanthonyfarrell@gmail.com
61
- or place them at the github issue page for this project at:
62
- http://github.com/bpython/bpython/issues/
114
+ ==========
115
+ Known Bugs
116
+ ==========
117
+ For known bugs please see bpython's `known issues and FAQ `_ page.
63
118
64
- For any other ways of communicating with bpython users and devs you can find us
65
- at the community page on the projects homepage:
66
- http://bpython-interpreter.org/community
119
+ ======================
120
+ Contact & Contributing
121
+ ======================
122
+ I hope you find it useful and please feel free to submit any bugs/patches
123
+ suggestions to `Robert `_ or place them on the github
124
+ `issues tracker `_.
67
125
68
- Or in the documentation at http://docs.bpython-interpreter.org/community.html.
126
+ For any other ways of communicating with bpython users and devs you can find us
127
+ at the community page on the `project homepage `_, or in the `community `_.
69
128
70
129
Hope to see you there!
71
130
72
- Features
73
- ========
74
-
75
- * In-line syntax highlighting.
76
- This uses Pygments for lexing the code as you type, and colours
77
- appropriately. Pygments does a great job of doing all of the tricky stuff
78
- and really leaving me with very little to do except format the tokens in
79
- all my favourite colours.
80
-
81
- * Readline-like autocomplete with suggestions displayed as you type.
82
- Thanks to Python's readline interface to libreadline and a ready-made class
83
- for using a Python interpreter's scope as the dataset, the only work here
84
- was displaying the readline matches as you type in a separate curses window
85
- below/above the cursor.
86
-
87
- * Expected parameter list.
88
- As in a lot of modern IDEs, bpython will attempt to display a list of
89
- parameters for any function you call. The inspect module is tried first,
90
- which works with any Python function, and then pydoc if that fails, which
91
- seems to be pretty adequate, but obviously in some cases it's simply not
92
- possible. I used pyparsing to cure my nested parentheses woes; again, it
93
- was nice and easy.
94
-
95
- * Rewind.
96
- I didn't call this "Undo" because I thought that would be misleading, but
97
- "Rewind" is probably as bad. The idea is that the code entered is kept in
98
- memory and when the Rewind function is called, the last line is popped and
99
- the entire code is re-evaluated. As you can imagine, this has a lot of
100
- potential problems, but for defining classes and functions, I've found it
101
- to be nothing but useful.
102
-
103
- * Pastebin code/write to file.
104
- I don't really use the save thing much, but the pastebin thing's great. Hit
105
- a key and what you see on the screen will be sent to a pastebin and a URL
106
- is returned for you to do what you like with. I've hardcoded
107
- paste.pocoo.org in for now, that needs to be fixed so it's configurable.
108
- Next release, I promise.
109
-
110
- * Flush curses screen to stdout.
111
- A featurette, perhaps, but I thought it was worth noting. I can't
112
- personally recall a curses app that does this, perhaps it's often not
113
- useful, but when you quit bpython, the screen data will be flushed to
114
- stdout, so it basically looks the same as if you had quit the vanilla
115
- interpreter.
116
-
117
- Configuration
118
- =============
119
- See the sample-config file for a list of available options. You should save
120
- your config file as ~/.config/bpython/config (i.e
121
- $XDG_CONFIG_HOME/bpython/config) or specify at the command line::
122
-
123
- bpython --config /path/to/bpython/config
124
-
125
- Known Bugs
126
- ==========
127
- For known bugs please see bpython's issue tracker at github:
128
-
129
- http://github.com/bpython/bpython/issues/
130
-
131
+ ===================
131
132
CLI Windows Support
132
133
===================
133
134
134
135
Dependencies
135
136
------------
136
- Curses
137
- Use the appropriate version compiled by Christoph Gohlke
138
- http://www.lfd.uci.edu/~gohlke/pythonlibs/
137
+ `Curses `_ Use the appropriate version compiled by Christoph Gohlke.
139
138
140
- pyreadline
141
- Use the version in the cheeseshop
142
- http://pypi.python.org/pypi/pyreadline/
139
+ `pyreadline `_ Use the version in the cheeseshop.
143
140
141
+ ===========
144
142
Recommended
145
- -----------
143
+ ===========
146
144
Obtain the less program from GnuUtils. This makes the pager work as intended.
147
145
It can be obtained from cygwin or GnuWin32 or msys
148
146
147
+ ==============================
149
148
Current version is tested with
150
- ------------------------------
151
- * Curses 2.2
152
- * pyreadline 1.7
149
+ ==============================
150
+ * Curses 2.2
151
+ * pyreadline 1.7
153
152
153
+ ============
154
154
Curses Notes
155
- ------------
155
+ ============
156
156
The curses used has a bug where the colours are displayed incorrectly:
157
- * red is swapped with blue
158
- * cyan is swapped with yellow
157
+ * red is swapped with blue
158
+ * cyan is swapped with yellow
159
159
160
- To correct this I have provided my windows.theme file.
160
+ To correct this I have provided a windows.theme file.
161
161
162
162
This curses implementation has 16 colors (dark and light versions of the
163
163
colours)
164
164
165
- See also
166
- ========
167
-
168
- Documentation
169
- http://docs.bpython-interpreter.org/
170
-
171
- Developer documentation
172
- http://docs.bpython-interpreter.org/contributing.html
165
+ .. _homepage : http://www.bpython-interpreter.org
166
+ .. _full documentation : http://docs.bpython-interpreter.org/
167
+ .. _cffi docs : https://cffi.readthedocs.org/en/release-0.8/#macos-x
168
+ .. _issues tracker : http://github.com/bpython/bpython/issues/
169
+ .. _pip : https://pip.pypa.io/en/latest/index.html
170
+ .. _project homepage : http://bpython-interpreter.org/community
171
+ .. _community : http://docs.bpython-interpreter.org/community.html
172
+ .. _Robert : robertanthonyfarrell@gmail.com
173
+ .. _bpython : http://www.bpython-interpreter.org/
174
+ .. _Curses : http://www.lfd.uci.edu/~gohlke/pythonlibs/
175
+ .. _pyreadline : http://pypi.python.org/pypi/pyreadline/
176
+ .. _known issues and FAQ : http://bpython-interpreter.org/known-issues-and-faq.html
0 commit comments