pysmell – Python auto-complete – works with TextMate too!

One of the reasons that kept me away (sigh) from TextMate is the lack of autocompletion support.. especially in Python. Seems like those days have ended – I just downloaded and installed Pysmell, and it works great!!!

The instructions are very clear, you install it, dbl click the TextMate bundle file and you’re already half way through. Just remember that you always need to generate a a PYSMELLTAGS file from your project, and put it at the root level so that TextMate finds it:


cd /root/of/project
pysmell .

For example, I wanted to add the django package to my ‘tags’ library:

[mac]@ego:/Library/Python/2.5/site-packages/django>pysmell . -o ~/PYSMELLTAGS.djangolib

And generate tags for the standard Python lib:

[mac]@ego:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5>pysmell *.py -o ~/PYSMELLTAGS.stndlib

Then I just moved these files to the root of my python project.. and it magically works!

picture-22

>>>

At first sight, the main drawbacks seem to be:

1) the ‘tags’ file you generate needs to be put into the project directory, not really handy if you have multiple projects.. (or if you say – update a library)

2) it may be slow (of course, depending on the size of the TAGS file you generate)

However – it’s great stuff, can’t wait to test it further!!!!

 

Share/Bookmark






6 Responses to “pysmell – Python auto-complete – works with TextMate too!”

Thanks for the kind works. I’m planning a ‘sprint’ at some point (it will be a bit longer, I’m afraid) to make PySmell a bit faster and a bit more easier to use.

If you have any more suggestions please ask!

Orestis Markou added these pithy words on Feb 16 09 at 10:58 am

Super Cool! I’m looking forward to the next version..
Here’s some more feedback – maybe it’ll help:
1) too many options are shown – what is that related to? [screenshot]
2) I try to select a choice, but textmate throws an error (well it’s textmate’s python-helper, to be precise) [screenshots 1 and 2] .The error is:
'unindent does not match any outer indentation level'
3) Ideally, the auto-completion function should also provide some hints about the arguments/usage of the symbol entered.. or does this happen already?

magicrebirth added these pithy words on Feb 16 09 at 1:35 pm

1. looks weird – it should detect that models is a specific package and give relevant options – if you have the correct import statement there.

2. Hm – the suggestion seems correct. Is selecting it throwing an error? Weird again.

3. Do you mean like constructor/method arguments? That happens already (you see them in the list). I would like to give a non-interactive pop-up but it’s tricky to do…

Orestis Markou added these pithy words on Feb 16 09 at 2:37 pm

I don’t get autocompletion to work here with leopard/textmate/pysmell. Pysmell was installed to my project folder. I tried to import the stdlib by doing

cd /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
/Users/matths/python/pysmell . -o ./PYSMELLTAGS.stdlib

afterwards there are some suggestions for completion, but they look wrong. e.g. there is no completion after ‘ran’, where I would expect ‘range()’ to pop up. etc. What do I do wring? Any help would be welcome!

matths added these pithy words on Jun 17 09 at 12:50 pm

when using
pysmell *.py -o ~/python/PYSMELLTAGS.stndlib

i get this error message
EXCEPTION in /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/*.py
[Errno 2] No such file or directory: ‘/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/*.py’

and using . instead of *.py leads to crazy autocompletion results :(

matths added these pithy words on Jun 17 09 at 1:48 pm

[…] For the record can I see a dude is using it with django: http://www.michelepasin.org/blog/2009/02/15/pysmell-python-auto-complete-works-with-textmate-too… […]

» Auto-complete Python in Textmate with Pysmell Emil's tech stuff added these pithy words on Jul 28 11 at 7:47 am