[2016.12.23]: I'm trying to make emacs be usable for working with python code. By 'usable' I mean I could rely on it with code navigation and completion.
I'm using spacemacs + anaconda-mode for it, but I'm not 100% satisfied.
For example, when I try to visit definition of 'get' function with M-. (anaconda-mode-find-definitions), I end up with message: "no definitions found". On the other hand, PyCharm does the job with it.
#!/usr/bin/env python
from avocado import Test
class MyTest(Test): # M-. on 'Test' ends up in test class. This is fine.
def test_mine(self):
myParam = self.params.get(key='myParm', path='/', default=None) ## M-. on 'get' fails. PyCharm does the job.
if __name__ == "__main__":
main()
I also tried to use elpy+jedi, but no luck as well.
What is Your experience with this simple example?
The code above uses avocado testing framework.
regards
[2016.12.27]: Below is another example, yet one I need, but hopefully also using more maintainable library, scapy: the packet forging library. All three imports are legal to execute the code, but only the last one makes emacs be able to jump to definition
#from scapy.all import * # imports all from scapy.layers.all, but it is not enough for emacs to see IP() def.
#from scapy.layers.all import * # gets all from scapy.layers.inet, but it is not enough for emacs to see IP() def.
from scapy.layers.inet import * #. ok with this.
packet = IP()
print packet.mysummary()
Question is is it possible to make emacs jump to definition when either first or second header is used instead of third one?
[2016.12.28]: Here is another example where my emacs python environment neither completes nor jumps to definition, although the code runs without error. it requires "pip install pyvim pyvmomi".
from pyVmomi import vim
vim.vm.CloneSpec()
How about Your emacs environments, do they handle such cases?
from avocado import Test
.get
method, or multiple possible sources. Finally, in Python it is possible to write code that generates methods dynamically, when they are called, so there isn't a universal way to find the source for a method - it simply may not even exist in your code base.avocado-framework
is a pain to install, making it hard to reproduce your example.jedi-core
+importmagic
+nose
+py-isort
+py-yapf
+sphinx-doc
+virtualenvwrapper
and happy with them.