Repository: spyder-ide/spyder

Issue:
Unable to load docstring into "Help" pane for functions with certain decorators
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [ ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [ ] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [ ] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [ ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description



### What steps reproduce the problem?

1. Install this library, `typeguard` (https://github.com/agronholm/typeguard) by `pip install typeguard`
2. Use the following script:
```python
from typeguard import typechecked

@typechecked
def func(a: int):
    """
    Parameters
    ----------

    a : int
        Something.
    """
    print('someting')

b = func(3)
```
3. Move your cursor to `func` in the last line of the script, and press `Ctrl + I` ("inspect current object"). 

### What is the expected output? What do you see instead?

The docstring cannot be loaded into the "Help" pane.

However, if you comment out the line `@typechecked`, and then press `Ctrl + I` (with the cursor on `func`), you will be able to see the docstring correctly loaded.

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.0.0
* Python version: 3.7.3
* Qt version: 5.9.6
* PyQt version: 5.9.3
* Operating System name/version: Windows 10 and Ubuntu 18.04

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.4.2 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
sphinx >=0.6.6               :  2.2.1 (OK)
pylint >=0.25                :  2.4.4 (OK)
psutil >=0.3                 :  5.6.5 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.0 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  1.4 (OK)
cython >=0.21                :  0.29.14 (OK)
IPython >=4.0                :  7.9.0 (OK)
matplotlib >=2.0.0           :  3.0.3 (OK)
pandas >=0.13.1              :  0.25.3 (OK)
numpy >=1.7                  :  1.17.3 (OK)
scipy >=0.17.0               :  1.3.1 (OK)
pyls >=0.31.2;<0.32.0        :  0.31.2 (OK)
rtree >=0.8.3                :  0.8.3 (OK)
```



Discussion:
I just wrote a small function to does nothing meaningful, and use this small function as a decorator on other functions. And this also reproduced the same issue.

This means that the root cause is not within the `typeguard` library. The root cause is some bugs in Spyder.
> The root cause is some bugs in Spyder.

We don't directly do code introspection in the editor, but depend on a library called Jedi for that.

According to https://github.com/davidhalter/jedi/issues/117#issuecomment-513595775 and https://github.com/davidhalter/jedi/commit/22580f771c7a5120f84a20ae14eb1330505a8b87 this should be fixed in the latest Jedi release (0.15.2).

So if that version fixes completions for Numpy, Pandas and Scipy, then this problem will be solved when we update to it for 4.1.0. If not, you'll have to wait until that's the case.
Thanks @ccordoba12 !

May I ask what the expected release date of Spyder 4.1.0 would be?

If it is just a version bump of Jedi and no corresponding Spyder code change is required, could you include this in Spyder 4.0.1 instead of 4.1.0?
> May I ask what the expected release date of Spyder 4.1.0 would be?

A couple of months.

> If it is just a version bump of Jedi and no corresponding Spyder code change is required, could you include this in Spyder 4.0.1 instead of 4.1.0?

Sorry but that's not going to happen because new Jedi versions require extensive testing to be sure they don't break things (as they usually do).
@ccordoba12 

Understandable. Thank you again!
Hi @ccordoba12 , I'd like to follow up on this `jedi` version thing with you -- is bumping `jedi`'s version still on your road map?  I tried to check Spyder's 4.1.0 milestone, but I saw that your team had converted to a sprint model.

Thanks!

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -209,7 +209,7 @@ def run(self):
     'ipython>=4.0',
     # This is here until Jedi 0.15+ fixes completions for
     # Numpy and Pandas
-    'jedi==0.14.1',
+    'jedi==0.15.2',
     # Don't require keyring for Python 2 and Linux
     # because it depends on system packages
     'keyring;sys_platform!="linux2"',
diff --git a/spyder/dependencies.py b/spyder/dependencies.py
--- a/spyder/dependencies.py
+++ b/spyder/dependencies.py
@@ -36,7 +36,7 @@
 DIFF_MATCH_PATCH_REQVER = '>=20181111'
 INTERVALTREE_REQVER = None
 IPYTHON_REQVER = ">=4.0;<6.0" if PY2 else ">=4.0"
-JEDI_REQVER = '=0.14.1'
+JEDI_REQVER = '=0.15.2'
 KEYRING_REQVER = None
 NBCONVERT_REQVER = '>=4.0'
 NUMPYDOC_REQVER = '>=0.6.0'


Test patch: