py-complete does not work on variables, only on module namespaces

Bug #1519867 reported by deuscovrigus@gmail.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
New
Wishlist
Andreas Roehler

Bug Description

py-shell-complete and py-complete work well on namespaces like numpy, cv2, matplotlib.pyplot , however, on variables only py-shell complete seems to work.
Consider the following example:

import numpy as np
x = np.array([1]) # completion works in the intermediate string x = np.arr with both py-complete and py-shell-complete.

However,

when attempting to complete
x.s # here only py-shell-complete gets all of the completions for this variable
Possible completions are:
x.swapaxes x.sum x.strides x.std
x.squeeze x.sort x.size x.shape
x.setflags x.setfield x.searchsorted

 whereas py-complete returns nothing.

The caveat is that py-shell-complete also fails if there is no *IPython* shell buffer open where my whole script ran. This sort of makes sense but I am wondering whether it would be possible to do everything in a separate, invisible shell.

Attempting to run py-documentation on the string 'x.shape' or any other function fails. Maybe this should be fixed? when running py-documentation on 'x = np.array' it works very well.

My question is: can py-complete work on variable names too? If not, how can I use py-shell-complete's list of completion to be passed to ac-sources. py-complete has the variable ac-sources-py-complete but I have found nothing of this sort for py-shell-complete.

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Low
importance: Low → Medium
Revision history for this message
deuscovrigus@gmail.com (deuscovrigus) wrote :

Is there any plan to add the py-shell-complete sources to the ac-sources list? I wish i'd knew how to do it, because py-shell complete seems more robust than py-complete

Revision history for this message
Andreas Roehler (a-roehler) wrote : Re: [Bug 1519867] Re: py-complete does not work on variables, only on module namespaces

On 13.01.2016 17:40, <email address hidden> wrote:
> Is there any plan to add the py-shell-complete sources to the ac-sources
> list? I wish i'd knew how to do it, because py-shell complete seems more
> robust than py-complete
>

It's just about replacing the symbol. Maybe send some report where
py-complete fails?

Revision history for this message
deuscovrigus@gmail.com (deuscovrigus) wrote :

As per the reported bug, py-copmplete only fails on variable names, whereas py-shell-complete doesn't. As a side note, I would like to know how I can integrate py-shell-complete with auto-complete (Maybe provide an ac-sources-py-shell-complete variable? ). So far py-shell-complete just pops a window with the completions

Changed in python-mode:
importance: Medium → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.