• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bpdb/H08-Nov-2021-209100

bpython/H08-Nov-2021-19,37014,901

bpython.egg-info/H03-May-2022-267195

data/H03-May-2022-6663

doc/sphinx/source/H08-Nov-2021-1,472905

theme/H08-Nov-2021-9081

.pycheckrcH A D08-Nov-202152 21

AUTHORS.rstH A D08-Nov-20211.1 KiB3026

CHANGELOG.rstH A D08-Nov-202131.5 KiB928720

LICENSEH A D08-Nov-20213.5 KiB7559

MANIFEST.inH A D08-Nov-2021525 1716

PKG-INFOH A D08-Nov-20219.9 KiB267195

README.rstH A D08-Nov-20217.4 KiB249178

pyproject.tomlH A D08-Nov-2021305 2725

setup.cfgH A D08-Nov-20211.6 KiB8672

setup.pyH A D08-Nov-20215.1 KiB195138

README.rst

1.. image:: https://img.shields.io/pypi/v/bpython
2    :target: https://pypi.org/project/bpython
3
4.. image:: https://readthedocs.org/projects/bpython/badge/?version=latest
5    :target: https://docs.bpython-interpreter.org/en/latest/
6
7.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
8    :target: https://github.com/ambv/black
9
10
11***********************************************************************
12bpython: A fancy curses interface to the Python interactive interpreter
13***********************************************************************
14
15`bpython`_ is a lightweight Python interpreter that adds several features common
16to IDEs. These features include **syntax highlighting**, **expected parameter
17list**, **auto-indentation**, and **autocompletion**. (See below for example
18usage).
19
20.. image:: https://bpython-interpreter.org/images/math.gif
21  :alt: bpython
22  :width: 566
23  :height: 348
24  :align: center
25
26bpython does **not** aim to be a complete IDE - the focus is on implementing a
27few ideas in a practical, useful, and lightweight manner.
28
29bpython is a great replacement to any occasion where you would normally use the
30vanilla Python interpreter - testing out solutions to people's problems on IRC,
31quickly testing a method of doing something without creating a temporary file,
32etc.
33
34You can find more about bpython - including `full documentation`_ - at our
35`homepage`_.
36
37==========================
38Installation & Basic Usage
39==========================
40
41Installation using Pip
42----------------------
43
44If you have `pip`_ installed, you can simply run:
45
46.. code-block:: bash
47
48    $ pip install bpython
49
50Start bpython by typing ``bpython`` in your terminal. You can exit bpython by
51using the ``exit()`` command or by pressing control-D like regular interactive
52Python.
53
54Installation via OS Package Manager
55-----------------------------------
56
57The majority of desktop computer operating systems come with package management
58systems. If you use one of these OSes, you can install ``bpython`` using the
59package manager.
60
61Ubuntu/Debian
62~~~~~~~~~~~~~
63Ubuntu/Debian family Linux users can install ``bpython`` using the ``apt``
64package manager, using the command with ``sudo`` privileges:
65
66.. code-block:: bash
67
68    $ apt install bpython
69
70In case you are using an older version, run
71
72.. code-block:: bash
73
74    $ apt-get install bpython
75
76Arch Linux
77~~~~~~~~~~
78Arch Linux uses ``pacman`` as the default package manager; you can use it to install ``bpython``:
79
80.. code-block:: bash
81
82    $ pacman -S bpython
83
84Fedora
85~~~~~~~~~~
86Fedora users can install ``bpython`` directly from the command line using ``dnf``.
87
88.. code-block:: bash
89
90    $ dnf install bpython
91
92Windows
93~~~~~~~
94**Caveats:** As ``bpython`` makes use of the ncurses library of \*nix-family operating systems,
95bpython on Windows is not officially supported and tested.
96
97However, you may still use bpython on Windows using a workaround. In brief, you should install
98these two packages using ``pip``:
99
100.. code-block:: bash
101
102    $ pip install bpython windows-curses
103
104Then you should invoke a program called ``bpython-curses.exe`` instead of ``bpython.exe`` to use bpython:
105
106.. code-block:: bash
107
108    $ bpython-curses
109
110Mac OS
111~~~~~~
112Like Windows, Mac OS does not include a package manager by default. If you have installed any
113third-party package manager like MacPorts, you can install it via
114
115.. code-block:: bash
116
117    $ sudo port install py-bpython
118
119===================
120Features & Examples
121===================
122* Readline-like autocomplete, with suggestions displayed as you type.
123
124* In-line syntax highlighting.  This uses Pygments for lexing the code as you
125  type, and colours appropriately.
126
127* Expected parameter list.  As in a lot of modern IDEs, bpython will attempt to
128  display a list of parameters for any function you call. The inspect module (which
129  works with any Python function) is tried first, and then pydoc if that fails.
130
131* Rewind.  This isn't called "Undo" because it would be misleading, but "Rewind"
132  is probably as bad. The idea is that the code entered is kept in memory and
133  when the Rewind function is called, the last line is popped and the entire
134  session is re-evaluated.  Use <control-R> to rewind.
135
136* Edit the current line or your entire session in an editor. F7 opens the current
137  session in a text editor, and if modifications are made, the session is rerun
138  with these changes.
139
140* Pastebin code/write to file.  Use the <F8> key to upload the screen's contents
141  to pastebin, with a URL returned.
142
143* Reload imported Python modules.  Use <F6> to clear sys.modules and rerun your
144  session to test changes to code in a module you're working on.
145
146=============
147Configuration
148=============
149See the sample-config file for a list of available options.  You should save
150your config file as **~/.config/bpython/config** (i.e.
151``$XDG_CONFIG_HOME/bpython/config``) or specify at the command line::
152
153  bpython --config /path/to/bpython/config
154
155============
156Dependencies
157============
158* Pygments
159* curtsies >= 0.3.5
160* greenlet
161* pyxdg
162* requests
163* Sphinx >= 1.5 (optional, for the documentation)
164* babel (optional, for internationalization)
165* jedi (optional, for experimental multiline completion)
166* watchdog (optional, for monitoring imported modules for changes)
167* pyperclip (optional, for copying to the clipboard)
168
169bpython-urwid
170-------------
171``bpython-urwid`` requires the following additional packages:
172
173* urwid
174
175==========
176Known Bugs
177==========
178For known bugs please see bpython's `known issues and FAQ`_ page.
179
180======================
181Contact & Contributing
182======================
183I hope you find it useful and please feel free to submit any bugs/patches
184suggestions to `Robert`_ or place them on the GitHub
185`issues tracker`_.
186
187For any other ways of communicating with bpython users and devs you can find us
188at the community page on the `project homepage`_, or in the `community`_.
189
190Hope to see you there!
191
192===================
193CLI Windows Support
194===================
195
196Dependencies
197------------
198`Curses`_ Use the appropriate version compiled by Christoph Gohlke.
199
200`pyreadline`_ Use the version in the cheeseshop.
201
202Recommended
203-----------
204Obtain the less program from GnuUtils. This makes the pager work as intended.
205It can be obtained from cygwin or GnuWin32 or msys
206
207Current version is tested with
208------------------------------
209* Curses 2.2
210* pyreadline 1.7
211
212Curses Notes
213------------
214The curses used has a bug where the colours are displayed incorrectly:
215
216* red  is swapped with blue
217* cyan is swapped with yellow
218
219To correct this I have provided a windows.theme file.
220
221This curses implementation has 16 colors (dark and light versions of the
222colours)
223
224
225============
226Alternatives
227============
228
229`ptpython`_
230
231`IPython`_
232
233Feel free to get in touch if you know of any other alternatives that people
234may be interested to try.
235
236.. _ptpython: https://github.com/jonathanslenders/ptpython
237.. _ipython: https://ipython.org/
238.. _homepage: http://www.bpython-interpreter.org
239.. _full documentation: http://docs.bpython-interpreter.org/
240.. _issues tracker: http://github.com/bpython/bpython/issues/
241.. _pip: https://pip.pypa.io/en/latest/index.html
242.. _project homepage: http://bpython-interpreter.org
243.. _community: http://docs.bpython-interpreter.org/community.html
244.. _Robert: robertanthonyfarrell@gmail.com
245.. _bpython: http://www.bpython-interpreter.org/
246.. _Curses: http://www.lfd.uci.edu/~gohlke/pythonlibs/
247.. _pyreadline: http://pypi.python.org/pypi/pyreadline/
248.. _known issues and FAQ: http://bpython-interpreter.org/known-issues-and-faq.html
249