Remote coding and execution with python: what IDE? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 months ago.
Improve this question 开发者_运维知识库I have been developing a project in python for the last six months, and love the language. But I have yet to find an IDE or text editor that could provide some extra functionality for me. I currently have syntax highlighting which is one of the easiest things to get, but not much more. I am dreaming of having my IDE jump to the line in my code that caused the crash instead of reading the line number from the backtrace and manually locating it in my text editor. I have been looking for something that could do this under my development constraints, but no success. My constraints are the following:
- The python code being developed rests on a remote machine, equipped with enough RAM and CPUs to run the code. That machine has no screen or keyboard.
- I code from my laptop, a macbook pro running OS X which is not meant to execute the code.
- The remote machine is running Fedora 12 and provides SSH connectivity with root access.
- My connection isn't good enough at home to run an X11 IDE on the distant machine and have the interface displayed on my machine.
What I have been doing up to now is to log-in to the remote machine via SSH using the excellent CyberDuck client. This enables me to open a text file residing on the remote machine inside any of my local usual text editors like TextMate or TextWrangler and have changes uploaded automatically every time the file is saved. This really gives you the felling you are editing the distant file in your usual cocoa interface.
Then to execute the python code, I open a second SSH connection, this time using a terminal into which I would type:
$ ssh user@dns
$ ipython -pylab
$ execfile("/projectdir/code.py")
Finaly, I read the backtrace and go back to my local text editor to find the correct line number. There must be a better way ! Any ideas ?
You may or may not like this suggestion, but I would use vim, setting makeprg and errorformat appropriately. This way you can ssh in as you normally would, edit files directly on the remote machine, and compile/error fix using quickfix-errorlist. It will only cost you the time to set makeprg and errorformat correctly. If you do a little digging the info is out there.
EDIT
- ssh user@intoyourbox.com
- Put the lines at the bottom of this answer in ~/.vimrc
- vim somemodule.py
- Type ":make somemodule.py"
- Type ":cw" which may stand for c as in the language, window
- vim will popup a window [Quickfix List]
- Cursor over an error in the [Quickfix List]
- Press enter
- vim changes your cursor to the window above and places it on the error
- Fix the error using your vim skills, ":h" for help and tutorials
- Ctrl+w, j will move the cursor down a window, back to your quickfix list
- Ctrl+w, k will move the cursor up a window
- Repeat steps 7-12 as necessary
- ":make somemodule.py" to make sure you fixed everything
- Welcome yourself to the darkside, vim rules.
~/.vimrc settings:
"python makeprg settings setlocal makeprg=python\ % setlocal errorformat= \%A\ \ File\ \"%f\"\\\,\ line\ %l\\\,%m, \%C\ \ \ \ %.%#, \%+Z%.%#Error\:\ %.%#, \%A\ \ File\ \"%f\"\\\,\ line\ %l, \%+C\ \ %.%#, \%-C%p^, \%Z%m, \%-G%.%#
Setting makeprg tells vim that your "compiler" is python. Setting the errorformat tells vim how to parse the output of your "compiler" so you can jump to error lines. Look around on the internet, there are plenty of vimrc suggestions for programming in python. There are makeprg/errorformat settings for Xcode/Visual C++/Perl/etc as well which really makes vim a win-win situation if you program in different languages. There's also other fancy stuff like autoindent, code completion and syntax highlighting. Enjoy
Note: These settings were taken almost verbatim from here.
here is a good list of Python-Editors.
In my opinion WingIDE (there's a free version) is very feature-rich, good and easy and supports Remote-Debugging (only in the commercial version). Also Eclipse PyDev-Plugin, which is fully free, is worth looking into it and seems to support Remote-Debugging.
You should keep your eye on PyCharm - it isn't production ready yet, but it has some real potential to be a great IDE. I've been using it for about 7 months now - you can renew the 45 day free trial as long as you keep your build current. I believe that remote debugging is a feature that the production version will support.
It's been years since I used it, but the commercial version of Komodo includes a remote debugger, and is generally a very competent package for Python programming.
Alternatively, you might try a standalone remote debugger: WinPdb - which, despite the name, works on Mac and Linux - is very good.
You could try the Professional version of PyCharm. It is by far the best remote debugger I have found till date.. there is full debugging functionality available for remote development. The only catch is that you might have to shell out a few dollars per year.
I have been using PyCharm for about 5 years and recently upgraded to Pro. It's great for local programming on your own computer.
However, I am doing remote programming now and I would not recommend it for that. I have been having a lot of problems with the remote debugger. There are so many configurations and parameters involved with remote programming - the ssh connection, the deployment configuration, the interpreter, and installed packages - that it's really hard to get set up just the way you want it, and if you somehow accidentally change something to screw it up, it's very hard to figure out how to get it back the way you want it.
They offer email support to Pro customers but in my experience it's almost useless. For example, I installed a new package in my remote environment and it is not visible to my local copy, even though other packages are, and I can't figure out why. Also, I have had a persistent error message since I have begun using the software. It takes at least a day or two for each response from a support person, and a ticket may require several responses, during which I'm completely stuck, so it is very disruptive. Also they asked me to send them my current configuration and code, which I can't because it's proprietary. The end result typically is that they ask the customer to delete the interpreter and reinstall it, but this can result in problems you didn't have before, and again, it's very hard to get it just the way you want it.
I am used to the look and feel of PyCharm and it will take a lot of effort to switch, but I have been spending so much time doing IDE management instead of development that it has really begun to get in my way and I am looking for a new product.
Judging from other complaints on their support system, I get the sense that JetBrains has put a lot of effort into developing an IDE but the recent need for remote development using cloud computing etc. has caught them off guard, and they haven't really put the resources into developing a usable debugger.
精彩评论