jedi library to replace rope for code introspection?

133 views
Skip to first unread message

Steven Silvester

unread,
Dec 29, 2012, 3:45:33 PM12/29/12
to spyd...@googlegroups.com
I took a stab at replacing rope with the jedi library, because it looks to be more promising based on the feature list at https://github.com/davidhalter/jedi.
The replacement is fully functional with support for completions, call tips, docstrings and goto definition.
However, it lacks two things found in the rope version: fast initial loading of large libraries like numpy and PyQt, and docstring support for functions with dynamic docstrings like functools.partial. 
Fixing these would take some similar patching as was done to the rope library, perhaps pushing back improvements to the jedi library.

What do you guys think, is this worth pursuing further?

I have attached the diff for the files affected:
spyderlib/widgets/sourcecode/codeeditor.py
spyderlib/widgets/editor.py   
spyderlib/plugins/inspector.py


Regards,
Steve Silvester

jedi.patch

Pierre Raybaut

unread,
Dec 30, 2012, 11:52:44 AM12/30/12
to spyd...@googlegroups.com
Hi,

Thanks a lot for this interesting patch. 
I'm especially interested in it as I was about to test the Jedi library to see what it has to offer. Simply by reading the feature list on the Jedi project website, I don't see a big difference with Rope features (am I wrong?) but I was hoping that it would have better performance. So what's about the performance gain from Jedi to Rope?

Cheers,
-Pierre
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To view this discussion on the web visit https://groups.google.com/d/msg/spyderlib/-/V5TQxcxhG4AJ.
To post to this group, send email to spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
<jedi.patch>

Steven Silvester

unread,
Dec 30, 2012, 12:55:35 PM12/30/12
to spyd...@googlegroups.com

Pierre,

Do you mean performance in terms of speed or capability?  In terms of speed, it appears to be at best as fast, but generally much slower than rope.  In terms of capability, the recursiveness of Jedi is pretty impressive.  From the example on the site,

import time


class Foo(object):

global time

asdf = time

def asdfy():

return Foo

xorz = getattr(asdfy()(), 'asdf')

xorz.strftime()


I get the proper docstring when using Jedi, but not with rope. Perhaps the easiest short-term solution is to use rope as is, and fall back on Jedi when no matches are found?

Pierre Raybaut

unread,
Jan 1, 2013, 5:13:46 PM1/1/13
to spyd...@googlegroups.com
Le 30 déc. 2012 à 18:55, Steven Silvester <steven.s...@gmail.com> a écrit :


Pierre,

Do you mean performance in terms of speed or capability?

I meant in terms of speed, because - from my perspective - the introspection features powered by "rope" are the things I hate the most in Spyder: it sometimes slows me down when I work on a slow machine, and they are undoubtedly far slower than the Pydev equivalent features. 

In terms of speed, it appears to be at best as fast, but generally much slower than rope.  In terms of capability, the recursiveness of Jedi is pretty impressive.  From the example on the site,

import time


class Foo(object):

global time

asdf = time

def asdfy():

return Foo

xorz = getattr(asdfy()(), 'asdf')

xorz.strftime()


I get the proper docstring when using Jedi, but not with rope. Perhaps the easiest short-term solution is to use rope as is, and fall back on Jedi when no matches are found?



Why not?
I see that you have open an issue on the GoogleCode project website. Things will have to be done with the necessary precautions (library detection) as for "rope". 

Cheers
-Pierre

To view this discussion on the web visit https://groups.google.com/d/msg/spyderlib/-/HXlGLZ-2tEEJ.
Reply all
Reply to author
Forward
0 new messages