(:emacs-version "26.1" :jedi-version "0.2.7")
((:name "sys" :file nil :version "3.6.6 (v3.6.6:4cf1f54eb7, Jun 26 2018, 19:50:54) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]")
(:name "jedi" :file "/Users/glyph/.emacs.d/.python-environments/default/lib/python3.6/site-packages/jedi/__init__.py" :version "0.12.1")
(:name "epc" :file "/Users/glyph/.emacs.d/.python-environments/default/lib/python3.6/site-packages/epc/__init__.py" :version "0.0.5")
(:name "sexpdata" :file "/Users/glyph/.emacs.d/.python-environments/default/lib/python3.6/site-packages/sexpdata.py" :version "0.0.3"))
Simple test:
$ mkdir ~/rel
$ echo 'from .rel2 import name' > ~/rel/rel1.py
$ echo 'name = 1' > ~/rel/rel2.py
$ emacs ~/rel/rel1.py
move your cursor over "name", M-x jedi:goto-definition, and "Definition not found.". I'd expect it to open rel1.py.
Previously: #1029 #973 #959 #161 #536
Wow I'm surprised that I can reproduce that. Imports are pretty well tested. There seems to be something wrong with the pseudo sys path Jedi is using.
$ python -c 'import jedi; jedi.set_debug_function(); print(jedi.Script(path="rel/rel1.py", line=1).goto_definitions())'
speed: init 0.20764708519
speed: parsed 0.208386898041
speed: import (<Name: rel2@1,6>,) 0.000600814819336
dbg: search_module u'rel' in '/home/dave/source/python/jedi_issues/vim-1183/rel/rel1.py'
warning: ImportError without origin: No module named rel
[]
Thanks for reporting it!
I just realized that this is not as bad as I originally thought, because you didn't have an __init__.py there. This is obviously still a bug, but implicit namespace packages are relatively new and underused :) I also don't have a lot of tests for namespace packages, so that explains it I guess.
Thank you for the report. I hope it's fixed now. It's at least one more test case, so one less case where it can break ;-)
Thanks for the fix!
Most helpful comment
Wow I'm surprised that I can reproduce that. Imports are pretty well tested. There seems to be something wrong with the pseudo sys path Jedi is using.
Thanks for reporting it!