elpy
elpy copied to clipboard
goto definition not working for my own modules in ein-mode
Summary
I cannot use elpy-goto-definition for my own modules when editing Jupyter notebooks.
Steps to reproduce
Say I am in Python project (you may clone it from https://github.com/xiaohan2012/test-goto-def) and wrote my own library mylib:
.
├── main.ipynb
├── main.py
└── mylib
├── __init__.py
└── module.py
where module.py contains:
def func():
pass
and main.py and main.ipynb contain the same:
import numpy as np
from mylib.module import func
Now I want to use elpy-goto-definition of func and np in both main.py and main.ipynb
It does not work when looking up func in main.ipynb
But it works for the remaining cases: looking up func in main.py and np in main.ipynb
My configuration
OS
MacOS Monterey
Result of (elpy-config)
Emacs.............: 27.2
Elpy..............: 1.35.0
Virtualenv........: .venv (/Users/hanxiao/code/test-goto-def/.venv)
Interactive Python: python 3.8.9 (/Users/hanxiao/code/test-goto-def/.venv/bin/python)
RPC virtualenv....: .venv (/Users/hanxiao/code/test-goto-def/.venv)
Python...........: python 3.8.9 (/Users/hanxiao/code/test-goto-def/.venv/bin/python)
Jedi.............: 0.18.1
Autopep8.........: 1.6.0
Yapf.............: 0.32.0
Black............: 22.3.0
Syntax checker....: flake8 (/Users/hanxiao/code/test-goto-def/.venv/bin/flake8)
Elpy configuration in my init.el
(use-package elpy
:ensure t
:config
(elpy-enable)
(setq elpy-test-runner 'elpy-test-pytest-runner ; use pytest
elpy-rpc-backend "jedi"
;; elpy-rpc-project-specific 't
elpy-modules (delq 'elpy-module-flymake elpy-modules)
)
(add-hook 'elpy-mode-hook 'flycheck-mode)
)
(use-package ein
:ensure t
)