How do you get Intellisense for Python in Eclipse/Aptana/Pydev? - python

Does anyone know how to get an intellisense like functionality (better than default) in eclipse for python development? I am using Eclipse 3.5 with aptana and pydev and the interpreter is python 2.5.2

You are probably never going to get something as good as intellisense for python. Due to the dynamic nature of python, it is often impossible to be able to know the type of some variables.
And if you don't know their types, you can't do auto-complete on things like class members.
Personally, I think the auto-complete in PyDev is pretty good, given the nature of python. It isn't as good as for Java and probably won't be, but it sure beats not having anything.
Having said that, I haven't tried if PyDev is able to use the parameter types you can specify in python 3.x. Otherwise, that might be an improvement that could make life a little easier.
Update: Got curious and did a quick test, Looks like optional type information in python 3 is not used by PyDev.

I'm using eclipse 3.6 and pydev with python 2.6 and it's the best one I've tested up to now. I didn't try 3.5 so not sure if it's the same as yours but I think it autocompletes well compared to others I tried but I didn't try any of the paid ones.

In Aptana I added the reference to the .egg file to the system PYTHONPATH in Preferences menu. I am not sure if this works for every library out there.
Preferences --> PyDev --> Interpreter Python --> Libraries tab on the right.

Related

Is it possible to implement automatic error highlighting for Python?

Are there any IDEs for Python that support automatic error highlighting (like the Eclipse IDE for Java?) I think it would be a useful feature for a Python IDE, since it would make it easier to find syntax errors. Even if such an editor did not exist, it still might be possible to implement this by automatically running the Python script every few seconds, and then parsing the console output for error messages.
eclipse+pydev
pycharm
many others ....
If you use VIM or don't have a problem with it, try this extension. https://github.com/klen/python-mode
This is for Emacs as well: https://github.com/gabrielelanaro/emacs-for-python
Also pycharm and eclipse with pydev work fine.
If I don't use vim I really enjoy spyder. It is easy to use and has some really nice features, like integrated debugging and profiling, graphical variable explorer and object inspector. The latter shows, e.g., the integrated documentation for every function of class you use.
I built an extension to Eclipse and PyDev that does what you describe, it runs the Python code as you're typing, and displays all the variable values and any exceptions that occur. It's called Live Coding in Python, and the web site has a tutorial and a demo video.
PyDev can highlight some problems in your code by analysing it, and Live Coding in Python can show you problems that happen when you run it.

Python 3.0 IDE - Komodo and Eclipse both flaky?

I'm trying to find a decent IDE that supports Python 3.x, and offers code completion/in-built Pydocs viewer, Mercurial integration, and SSH/SFTP support.
Anyhow, I'm trying Pydev, and I open up a .py file, it's in the Pydev perspective and the Run As doesn't offer any options. It does when you start a Pydev project, but I don't want to start a project just to edit one single Python script, lol, I want to just open a .py file and have It Just Work...
Plan 2, I try Komodo 6 Alpha 2. I actually quite like Komodo, and it's nice and snappy, offers in-built Mercurial support, as well as in-built SSH support (although it lacks SSH HTTP Proxy support, which is slightly annoying).
However, for some reason, this refuses to pick up Python 3. In Edit-Preferences-Languages, there's two option, one for Python and Python3, but the Python3 one refuses to work, with either the official Python.org binaries, or ActiveState's own ActivePython 3. Of course, I can set the "Python" interpreter to the 3.1 binary, but that's an ugly hack and breaks Python 2.x support.
So, does anybody who uses an IDE for Python have any suggestions on either of these accounts, or can you recommend an alternate IDE for Python 3.0 development?
Cheers,
Victor
Try PyCharm from JetBrains.
You did not mention these so I'm not sure if you've tried them but there are:
- Aptana (aptana.com)
- The Eric Python IDE (http://eric-ide.python-projects.org/)
- WingWare Python IDE (wingware.com)
I haven't used any of them so I don't know if they will match your needs, but I'd expected them to be pretty close as they are all mature.
As for PyCharm, I've been using it for a while and it's fine, actully I like it very much.
However I'm a Python noob and probably do not use many advanced features so YMMV.

Bad auto completion with python on pydev?

I began learning and loving python about a month ago. Dive into python, django and now Tornado is the path i followed during this time.
I chose pydev as an IDE since it seems to be the most up to date and i wanted to come back to eclipse since i'm using Netbeans for php and Java.
My question is the following:
When i write classes in php or java i declare my methods and properties. I instantiate them somewhere else and use them. The autocompletion works great for java and php but with python, it seems to be always suggesting me a bunch of garbage and never the real object's methods from the class i instantiated.
Is it the same for you ? Is it a limitation from pydev ? Am i doing something wrong ?
Thank you in advance for pointing me in a direction.
Matthieu.
First make sure your interpreter is set up correctly.
Window | Preferences | Pydev | Interpreter - Python
I use cpython on linux so my interpreter is
cpython /usr/bin/python25
Under Libraries, make sure all the standard PYTHONPATH stuff is in there:
System Libs
/usr/lib/python2.5
/usr/lib/python2.5/site-packages
/usr/lib/python2.5/wx-2.8-gtk2-unicode
/usr/lib/python2.5/lib-tk
/usr/lib/python25.zip
etc....
You can also add any non standard paths here by clicking New Folder.
Do not add paths to your own source code though. These should come in when you configure a pydev projec, select a "src" folder and start making modules, see here.
Well, as you didn't say what 'garbage' is showing, it's a bit hard to guess, but I believe you mean the __hash__, __str__, etc from the object class (is that it?)
If that's the case, this has been dealt in the current nightly build (the '_' methods will still appear, but with lower priority, so, the methods you're probably more interested in are at the top)
Pycharm (http://www.jetbrains.com/pycharm/index.html) is much better than Pydev for auto completion, among other things.

Which editor/IDE should I use for Python? [duplicate]

This question already has an answer here:
Closed 13 years ago.
Possible Duplicate:
What IDE to use for Python
I have Notepad++ and NetBeans 6.8, however I don't know if they work. I know you can edit Python with Notepad++ and compile/run it using the command line thing, but I'm not really sure how. I know NetBeans is a full-featured IDE and you can compile Java programs, but I don't think they support Python?
Any ideas?
Eclipse with PyDev has been a great combination for me. Great editing experience and more importantly a good debugger. Pylint is supported as well, this will save you lots of headaches. This is all open source too. If you want to do IronPython development though I would add SharpDevelop 3.1.1. It has a drag & drop GUI form designer and overall is very much like Visual Studio, except it's free of course.
Actually, netbeans has some python support right now: http://wiki.netbeans.org/Python. It works (still I prefer a plain text editor).
For a list of python IDEs i'd call this list comprehensive: What IDE to use for Python?
I like PyDev under Eclipse ( and of course Eclipse does Java too).
I am using eclipse with pydev extension
Have a look at PythonEditors, there is a huge list of editors/IDEs with python-support.
You have IDLE installed with Python. It is good editor which serves the purpose well. It is multi windowed, have syntax highlighting and auto complete features.
I use Komodo Edit for all of my Python work. Actually, I use Komodo Edit for all of my IDE uses save for when I'm working in .Net. It's not really a full on IDE, but it's been perfect for everything I've used it for. It's pretty lightweight, has good syntax highlighting, but doesn't shove a lot of arcane project file overhead at you that you'd need to learn. It's worth having around, in my opinion, even if it doesn't suit your needs for Python.
Python doesn't need to be compiled - it compiles itself (to bytecode) when you run it. Any text editor will work.
Edit in response to comment: Yes, absolutely (although I think NetBeans does support Python). You'll find that IDEs are much less of a requirement when using a dynamic language like Python or Ruby, compared to Java or C#.
I would go with IntelliJ IDEA, it has a great python plugin.
Eclipse with PyDev is also nice, if you like open source.
I'm certain there are a number of IDEs with Python plugins (Eclipse and Emacs spring to mind) but there are two things you want to look for. The first is support for basic lint checking (little red squiggly concept) through some kind of tool (pylint or pychecker). The second is support for running the Python interpreter embedded into it.

New to Python. Need info on the environment for it

I'm a complete newbie to Python. I've worked on PHP/JavaScript earlier but starting today I'm moving onto Python. I have no idea about the environment needed for it. I could use some suggestions on it for me to get started.
Under Unix, Emacs is a good choice, to which I always come back, because it is convenient to have a single editor for everything, and because it's open source.
What is best for you depends on your past experience with IDEs. I'd say: stick with what you've been using, or take this opportunity to try an even better IDE.
Note: Python comes with Idle, which is a very simple (if limited) IDE.
Be sure to check out IPython. It's an enhanced interactive python shell with a bunch of useful features such as Tab-Completion using introspection (eg, type "my_object." to see a list of its attributes and methods), logging your interactive session to an executable python-file, defining macros, etc. The documentation page has a link to the tutorial as well as screencasts showing it in action.
On my mac/Linux machines, python came pre-installed. On windows I use both jython under the eclipse IDE and ActivePython with their IDE/eclipse.   With eclipse you'll want PyDev.
It all depends on what you are looking for and what you are already using.
For instance, if you are using a more 'simple' editor at the moment: as long as it's got Python syntax you've got the basics.
If you are used to e.g. Eclipse you can just continue to use that, combined with Pydev. Besides syntax highlighting you'll also get more fancy features to help you debug and refactor your code.
Personally I use Emacs with python-mode (and a few other modes to interface with Subversion and Git). In the past I used Vim which also worked quite well.
My advice would be to start out with your current environment as long as it has some rudimentary support for Python. Once you are familiar with the language, start exploring what your environment is missing and either add it or if you cannot, switch to an enviroment which does support the feature.
I use gvim with some plugin in order to have better support for python.
If you like IDE, look at wing IDE wich is the best I have tested so far. Especially the debuger included is really helpful.
The Python Beginner's Guide and the official Python Tutorial both seem like good places to start.
Geany is a good option for a Linux setup, it's intellisense isn't that great but syntax highlighting is good and it can compile your code directly from inside the editor, plus it handles other languages such as C/C++, PHP, Java etc... Eric is another popular choice as it's a full IDE and I know some people use Eclipse.
On windows I use Notepad++, but it's mostly because I like text editors instead of fully blown IDE's.
Reference wise Daniel's choices are very good places to start, also check out Green Tea Press who do free computer books, there are two Python choices on there but the "Python for Software Design" book hasn't yet been published properly although you can download the manuscript. The "How to Think Like a Computer Scientist" book is a good one and not as scary as it sounds.
IDLE is nice to try out things. Other tools that people like are Eclipse with the Pydev plugin which seems to work ok, although it has crashed a few times (Eclipse, that is) and NetBeans (which I haven't tried) but some people seem to like.
I can only help you if you're running a Mac. Download Xcode. I believe that Python 2.3 comes bundled with these development tools. Luckily enough, this is all you really need to get started, unless you want a newer version of Python.
All you need to do is open up Terminal and type python. You're done!

Categories

Resources