Ticket #10959 (closed enhancement: fixed)
|Reported by:||mashbudn||Owned by:||robind|
|Keywords:||Py, PyCrust, PySlices, slices, shell, PyShell, editor||Cc:||david.n.mashburn@…|
I am finally uploading the changes I have added to PyCrust -- I took over as maintainer for the Py project in January.
The main additions to PyCrust include:
- Better autoindentation
- Some automatically loaded path features (cd, ls, pwd)
- Support for magic command interpretation (magic.py, somewhat like what ipython does)
- Support for the "func 1" -> "f(1)" comstruct
- Multiple arguments written as: "func 1,2,3,4" -> "func(1,2,3,4)"
- Ignores keywords and operators
- Special support for cd, ls, pwd so they can be used like: "pwd" , "ls" , "ls *" , "ls *.py" , "cd .." , "cd /usr/"
In addition, I have also created a modified PyCrust called
PySlices which adds the following features:
- A notebook-style interface ala SAGE or Mathematica
- Use of colored markers instead of prompts (>>>)
- Red markers = input (aka hot = editable)
- Blue markers = output (aka frozen = not editable)
- Black markers = grouping (to bundle respective input to its output)
- Blocks of homogeneous lines are called "slices", so I refer to "input slices", "output slices", and "grouping slices"
- Support for multi-line commands like:
- Previous commands can be run IN PLACE!!
- Restructuring of the keybindings:
- RETURN adds a newline
- ENTER and SHIFT+RETURN run commands
- CTRL+RETURN calls manual auto-completion
- Added keybindings for markers:
- Ctrl-D divides an input "slice"
- After selecting adjacent slices, Ctrl-M merges slices (if they are the same type)
I have found these changes to be both more productive and beginner-friendly. Most important are the simple abilities to and the ability to re-run previous commands in place. Specifically, I frequently use the ability to:
- Run more than one command at once in a single slice
- Re-run previous commands in place
- Paste in any amount of code for debugging scripts
- Run code from a whole script in a single "input slice"
- Remove or add code in place
- Break code into multiple slices using slice division feature, allowing the same code to be run in different sequences without any typing or editing
- Perform tests on code without any saving or overwriting of code, unlike with a traditional editor
- Have all executed code saved in the history
- Create extra test code either in the same slice or in a new slice
- Delete long outputs
Known bugs / Planned additions:
- wx.STC (and underlying Scintilla) does not properly handle markers during Undo
- I have been told that this functionality will not be added to Scintilla, as the current behavior is preffered in their project
- We (I) will have to copy their undo-history hierarchy mechanism to make Undo function properly with markers so that slices will maintain their integrity
- I am planning to implement a save format so that PySlices sessions can be saved and loaded (ala SAGE or MATHEMATICA)
- I would like to implement a keybinding system with a graphical interface so that users can manually adjust the keybindings to suit their needs
Wish list / Far-reaching goals:
- I would love to add more of ipython's features, but want to focus on the things that are most useful (unless someone REALLY wants to help in adding ipython's interpreter as a backend...)
- I would love to be able to display graphics within the shell (especially for plotting with pylab)
- I would really love to implement a good WYSIWYG equation editor in wxPython that can be used from within some sort of shell / notebook with 3 way conversion support between WYSIWYG math formatting, TeX, and sympy. The eventual goal would be to be able to use greek letters and mathematical notation as input and output in a python shell.
- I have toyed with the idea of making a shell that can also interpret (with dynamic compilation) either Cython or C code for testing purposes
I know my wish list is pretty out there, but I just wanted to spell it out in case anyone wanted to help brainstorm ideas for implementing any of it!
My main focus will of course be in improving the stability and quality of the Py suite, with a focus on the new PySlices.
Personally, I now use PySlices on a daily basis and it performs the way I always wished that a shell would. I hope other people enjoy it too!