Python IDE on Linux Console

This may sound strange, but I need a better way to build python scripts than opening a file with nano/vi, change something, quit the editor, and type in python script.py, over and over again.

I need to build the script on a webserver without any gui. Any ideas how can I improve my workflow?

Answers


put this line in your .vimrc file:

:map <F2> :w\|!python %<CR>

now hitting <F2> will save and run your python script


You should give the screen utility a look. While it's not an IDE it is some kind of window manager on the terminal -- i.e. you can have multiple windows and switch between them, which makes especially tasks like this much easier.


You can execute shell commands from within vim.


Using emacs with python-mode you can execute the script with C-c C-c


you can try ipython. using its edit command, it will bring up your editor (nano/vim/etc), you write your script, and then on exiting you're returned to the ipython prompt and the script is automatically executed.


When working with Vim on the console, I have found that using "tabs" in Vim, instead of having multiple Vim instances suspended in the background, makes handling multiple files in Vim more efficient. It takes a bit of getting used to, but it works really well.


You could run XVNC over ssh, which is actually passably responsive for doing this sort of thing and gets you a windowing GUI. I've done this quite effectively over really asthmatic Jetstart DSL services in New Zealand (128K up/ 128K down =8^P) and it's certainly responsive enough for gvim and xterm windows. Another option would be screen, which lets you have multiple textual sessions open and switch between them.


There are actually 2 questions. First is polling for a console IDE for python and the second is a better dev/test/deploy workflow.

For while there are many ways you can write python code in the console, I find a combination of screen, vim and python/ipython is the best as they are usually available on most servers. If you are doing long sessions, I find emacs + python-mode typically involves less typing.

For a better workflow, I would suggest setting up a development environment. You can easily setup a Linux VM on your desktop/laptop easily these days - there isn't a excuse not to even if it's for hobby projects. That opens up a much larger selection of IDEs available to you, such as:

I would also setup a SCM to keep track of changes so that you do better QA and use it to deploy tested changes onto the server.

For example I use Mercurial for my pet projects and I simply tag my repo when it's ready and update the production server to the tag when I deploy. On the devbox, I do:

  • (hack hack hack, test test test)
  • hg ci -m 'comment'
  • hg tag
  • hg push

Then I jump onto the server and do the following when I deploy:

  • hg update
  • restart service/webserver as needed

Well, apart from using one of the more capable console editors (Emacs or vi would come to mind), why do you have to edit it on the web server itself? Just edit it remotely if constant FTP/WebDAV transfer would seem to cumbersome.

Emacs has Tramp Mode, gedit on Linux and bbedit on the Mac support remote editing, too. Probably quite a large number of other editors. In that case you would just edit in on a more capable desktop and restart the script from a shell window.


Need Your Help

Connect to a remote server and use the remote collection

javascript meteor

I have two applications to be deployed seperately, but partially sharing a database and users. I created a pretty simple method to connect.

Lines do not render on an offscreen frame buffer with a completely black texture

python opengl framebuffer alphablending pyopengl

If I have a frame buffer which has a textured binded to it which is simply black with full alpha and I try to draw a line to it, even if the line has full alpha it wont render. I'm not stupid, so the