Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbisbee/python-shell-enhancement
Just a simple script that will add history and basic tab completion to the default python shell
https://github.com/jbisbee/python-shell-enhancement
Last synced: 13 days ago
JSON representation
Just a simple script that will add history and basic tab completion to the default python shell
- Host: GitHub
- URL: https://github.com/jbisbee/python-shell-enhancement
- Owner: jbisbee
- License: mit
- Created: 2013-07-27T02:08:33.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-06-20T22:06:07.000Z (over 5 years ago)
- Last Synced: 2024-08-01T22:57:17.833Z (3 months ago)
- Language: Python
- Size: 186 KB
- Stars: 34
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-shell-enhancement #
Just a simple python startup script that will add the following to the standard python shell:
* Persistent shell history between sessions
* Tab completionI just found it odd that the default shell didn't out of the box. Yes, I
do know about about alternative python shells that support these features
(and many more)* bpython http://bpython-interpreter.org/
* iPython http://ipython.org/### Installation ###
**1. Checkout the project**
```console
jbisbee@tacquito:~ $ cd ~/src
jbisbee@tacquito:~/src $ git clone https://github.com/jbisbee/python-shell-enhancement.git
```**2. Add PYTHONSTARTUP and possibly PYTHON_HISTORY_FILE to your shell**
```bash
# .bashrc# path the the newly checked out project. I used ~/src
export PYTHONSTARTUP="$HOME/src/python-shell-enhancement/pythonstartup.py"# this is the default value, no need to change it if you don't care
export PYTHON_HISTORY_FILE="$HOME/.pythonhistory"
```**3. Now test it out***
The default shell now has persistent history and tab completion. Enjoy!
```console
jbisbee@beni:~$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Interactive mode history and tab completion are enabled.
>>> sys.[--TAB--]
sys.__class__( sys.__delattr__( sys.__dict__
sys.__displayhook__( sys.__doc__ sys.__egginsert
sys.__excepthook__( sys.__format__( sys.__getattribute__(
sys.__hash__( sys.__init__( sys.__name__
sys.__new__( sys.__package__ sys.__plen
sys.__reduce__( sys.__reduce_ex__( sys.__repr__(
sys.__setattr__( sys.__sizeof__( sys.__stderr__
sys.__stdin__ sys.__stdout__ sys.__str__(
sys.__subclasshook__( sys._clear_type_cache( sys._current_frames(
sys._getframe( sys.api_version sys.argv
sys.builtin_module_names sys.byteorder sys.call_tracing(
sys.callstats( sys.copyright sys.displayhook(
sys.dont_write_bytecode sys.exc_clear( sys.exc_info(
sys.exc_type sys.excepthook( sys.exec_prefix
sys.executable sys.exit( sys.exitfunc(
sys.flags sys.float_info sys.float_repr_style
sys.getcheckinterval( sys.getdefaultencoding( sys.getdlopenflags(
sys.getfilesystemencoding( sys.getprofile( sys.getrecursionlimit(
sys.getrefcount( sys.getsizeof( sys.gettrace(
sys.hexversion sys.long_info sys.maxint
sys.maxsize sys.maxunicode sys.meta_path
sys.modules sys.path sys.path_hooks
sys.path_importer_cache sys.platform sys.prefix
sys.ps1 sys.ps2 sys.py3kwarning
sys.setcheckinterval( sys.setdlopenflags( sys.setprofile(
sys.setrecursionlimit( sys.settrace( sys.stderr
sys.stdin sys.stdout sys.subversion
sys.version sys.version_info sys.warnoptions
>>> sys.
```### Acknowledgements ###
Thanks to Geoff Ford for the orignal code I took from his blog post.
http://geoffford.wordpress.com/2009/01/20/python-repl-enhancement/Thanks for Jabba Laci for taking time to report an issue on github.
### Authors ###
* **Jeff Bisbee** http://jbisbee.blogspot.com/
* **Geoff Ford** http://geoffford.wordpress.com/
* **Jabba Laci** https://github.com/jabbalaci - issue on github should have been {0} in string format instead of {1}
* **Kevin Deldycke** http://kevin.deldycke.com