Skip to content

LFSaw/python-interactive.tmbundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README

This is the first version of a python interactive mode for TextMate implementing REPL.

Please do not hesitate to contribute. Feedback's welcome, too, but, unfortunately, I can't guarantee that I'm able to fix bugs ('cause I'm new to textmate and screen)

LICENCE

CC-GNU GPL
This software is licensed under the CC-GNU GPL version 2.0 or later.

Requirements

  • TextMate
  • iTerm
    • a bookmark Screen'd Python in iTerm that executes the following cmd:
    • /usr/bin/env screen -S iPythonSession -t iPython
  • Python installation (of course)

Installation

Double-Click the tmbundle contained in this zip-file, it should automatically install itself (as long as you have textMate installed)

Usage

  • call Open Terminal with Screened Python
    • A Terminal window should appear saying Welcome to Python Interactive
  • enter (fn-return) executes the line or selection in the python screen-session.
  • When done with your interactive session, ctrl-d the python process in iTerm and end the screen session via ctrl-d. If you don't do it that way, it wil be still there (as a detached screen session).

If something goes wrong, it may be caused by an already-running screen session. Look for it via screen -ls and kill it by attaching (screen -r <pid>) and ctrl-d.

Customization

Support for

  • Terminal.app / iTerm.app
  • python / ipython

Defaults are terminal and python. This can be changed by declaring

  • TM_TERM_PROG=iTerm
  • TM_PYTHON_INTERACTIVE=ipython

in TextMate's Advanced Preferences.

Known Bugs

  • python interactive needs additional newline behind scopes like function def's or loops, since it relies on the python -i mode.
  • Still very alpha.

Big Thanx

Big Thanx go to technotales for his excellent howto on slime, vim, screen and REPL, Thomas Hermann the initial idea and suggestions on how to automate the screen creation process, and to the SuperCollider community, which inspired me to look for a way to get python REPL'y to work in TextMate.

Authors

so far:

  • 2009, LFSaw, (lfsaw at lfsaw dot de)

Release Notes

  • Tue Apr 21 11:12:05 CEST 2009
    • Fixed limited length of variables (as reported by thomas) in bash by reading stdin.
    • Due to this, it is currently not possible to surround input by "#{" "#}" in "python -i" mode.
    • this bundle needs scripts to have an empty line trailing regular scopes like function def's or loops, since it relies on the python -i mode.
  • Sun Apr 19 12:57:28 CEST 2009
    • complete rewrite of screen sesison creation based on thomas' suggestions
    • changed default keyboard shortcut for evaluation of selection to enter (function-return)
    • added support for terminal and ipython (defaults are terminal and python, iterm and ipython can be switched on by declaration of TM_TERM_PROG=iTerm resp. TM_PYTHON_INTERACTIVE=ipython in TextMate's "Advanced Preferences")
    • changed interpret to use bash instead of python (prevents python to misinterpret (single-)quotes)
  • Fri Apr 17 18:26:34 CEST 2009
    • First release
    • manual creation of screen session required
    • supressing python interactive prompts

ToDos

  • TODO customize, such that iPython supresses prompts
  • TODO use custom iTerm layout
  • TODO bookkeeping of open screen sessions

About

Implementing REPL for python in TextMate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published