I am trying to use Elpy for Emacs to write Python programs. The auto-complete feature suggests all attributes of PyQt5 classes, but suggests only a subset of the attributes of instances of these classes.
All attributes of the class QLabel are suggested when I type this in Emacs:
from PyQt5.QtWidgets import QApplication, QLabel
app = QApplication([])
label = QLabel()
QLabel.
However, if I replace the last line with:
label.
then only a small subset of the attributes are suggested. (The
missing attributes include those marked as "module" when I type
QLabel.
For example the method getText()
is missing.) This is
strange because Elpy (or company or jedi?) clearly knows the type of
label
to be able to suggest a subset of its attributes!
I am using a fresh install of kubuntu 18.04, with Emacs 25 and Python 3 installed from packages, and follow the Installation instructions for Elpy.
apt install python3 python3-pip emacs
pip3 install virtualenvwrapper
I use a virtual environment called elpy
with these packages installed:
(elpy) prompt$ pip list
Package Version
----------- -------
appdirs 1.4.3
attrs 19.1.0
autopep8 1.4.3
black 19.3b0
Click 7.0
entrypoints 0.3
flake8 3.7.7
jedi 0.13.3
mccabe 0.6.1
parso 0.3.4
pip 19.0.3
pycodestyle 2.5.0
pyflakes 2.1.1
PyQt5 5.12.1
PyQt5-sip 4.19.15
rope 0.14.0
setuptools 40.8.0
toml 0.10.0
wheel 0.33.1
yapf 0.26.0
Here is my .emacs.d/init.el
:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
(elpy-enable)
(custom-set-variables
'(package-selected-packages (quote (elpy))))
(custom-set-faces)
Output from elpy-config
:
Virtualenv........: elpy (/home/asbuch/lib/virtualenvs/elpy)
RPC Python........: 3.6.7 (/home/asbuch/lib/virtualenvs/elpy/bin/python)
Interactive Python: python (/home/asbuch/lib/virtualenvs/elpy/bin/python)
Emacs.............: 25.2.2
Elpy..............: 1.28.0
Jedi..............: 0.13.3
Rope..............: 0.14.0
Autopep8..........: 1.4.3
Yapf..............: 0.26.0
Black.............: 19.3b0
Syntax checker....: flake8 (/home/asbuch/lib/virtualenvs/elpy/bin/flake8)
Any help is greatly appreciated!