Open PhilipYip1988 opened 9 months ago
Hey @PhilipYip1988, thanks for reporting. I can't reproduce this on Linux.
@dalthviz, can you try it on Windows? Thanks!
Although I'm not sure if I'm testing this correctly (when you say docstrings and identifiers @PhilipYip1988 you mean like the completion options that are retrieved and also that for the highlighted completion option its documentation is shown, right?). Checking locally I got the same behavior regardless of testing with Spyder 6 from conda and Spyder 5.5.0 for all the cases. However, indeed there are cases when Spyder does not provide any docstring/completion from the Editor like the ones mentioned over the OP, maybe some regression regarding completion happened between Spyder 5.4.3 and 5.5.0?
Here are some screenshots, no identifiers show for pd:
Like they do for numpy:
Also for the docstring, datetime.time shows:
Also for the docstring, datetime.datetime does not show:
I would like to sincerely ask whether there is a solution for this.
We don't know why this is happening, sorry.
Retested with Spyder 6.0.0a5.
datetime.
# works as expecteddatetime.timedelta
# works as expecteddatetime.timedelta()
# works as expecteddatetime.datetime.
# works as expecteddatetime.datetime()
# Docstring does not display when input with open parenthesistime.
# works as expectedtime.sleep
# works as expectedtime.sleep()
# works as expectedtime.time
# works as expectedtime.time()
# works as expectedtime.time_ns
# works as expectedtime.time_ns()
# Docstring does not display when input with open parenthesisnp.
# works as expectednp.array
# works as expectednp.array()
# works as expectedx.
# works as expectedx.sum
# works as expectedx.sum()
#works as expectedpd.
# works as expectedpd.Series
# works as expectedpd.Series()
# works as expectedpd.Series.
# no Series identifiers displaypd.DataFrame
# works as expectedpd.DataFrame()
# works as expectedpd.DataFrame.
# no DataFrame identifiers displaydf.
# no DataFrame identifiers displaydf.x.
# no Series identifiers display (attribute access)df['x'].
# no Series identifiers display (key access)@PhilipYip1988, thanks for the very detailed update! I collapsed the screenshots of those things that are working and left the ones that are not, so we can focus on solving them.
@dalthviz, please take care of this one.
Note: Seems like the majority of cases listed here are not working as expected due to a change over the upper limit of jedi done at https://github.com/spyder-ide/spyder/commit/60ae3c650d2c5778a12f5b5a3fcfec8fef63f507 (so it affects Spyder >= 5.5.0).
When checking things with jedi 0.18.2 and latest master things work except for:
Cases like df.x.
and df['x']
: From the Console seems like this works, which thinking about it, seems like something that we have discussed previously and would imply to somehow connect the completions from the Console to the ones from the Editor (to have such completions you would need to actually execute the code, right @ccordoba12 ?)
Cases like time.time_ns()
: I think the docstring/signature tooltip is not being displayed when you input parenthesis since those methods/functions don't have arguments in their signature. Basically, the current way Spyder handles this is by showing the tooltip when typing the parenthesis only if the function/method has arguments. Still, if you want to see the tooltip you can hover over the definition and it should appear regardless of the function/method having args/kwargs or not. As an example of the handling of something with args/kwargs vs something without them:
Should we change this behavior @ccordoba12 ?
Note: Seems like the majority of cases listed here are not working as expected due to a change over the upper limit of jedi
Thanks for digging into this @dalthviz! Let's leave it for 6.0.1 then because it's not so simple to fix (you'll need to run git bisect
on the Jedi repo between 0.18.2 and the latest release to find exactly what introduced the problem and report that upstream).
Cases like df.x. and df['x']: From the Console seems like this works, which thinking about it, seems like something that we have discussed previously and would imply to somehow connect the completions from the Console to the ones from the Editor (to have such completions you would need to actually execute the code, right @ccordoba12 ?)
Correct, that's the only way to fix that. But that will work only if you've run your code first.
Should we change this behavior @ccordoba12 ?
Yeah, I think that's a good idea and you can implement it for 6.0.0 because it doesn't sound too hard to fix.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
pandas identifiers for Series and DataFrame don't display properly in the script editor. docstring for a class in a standard module does not display when module and class name are the same e.g. datetime.datetime or time.time
What steps reproduce the problem?
a. np. # display correctly b. x. # display correctly c. pd. # display correctly d. df. # display correctly Spyder 5, don't display Spyder 6 e. pd.Series. # display correctly Spyder 5, don't display Spyder 6 f. pd.DataFrame. # display correctly Spyder 5, don't display Spyder 6 g. df.x. # Series accessed from DataFrame as an attribute, don't display Spyder 5 or 6 h. df['x']. # Series accessed from DataFrame as an index, don't display Spyder 5 or 6 i. datetime. # Identifiers display correctly Spyder 5 or 6 j. datetime.timedelta # Identifiers display correctly Spyder 5 or 6 k. datetime.timedelta() # Docstring displays correctly Spyder 5 or 6 l. datetime.datetime. # identifiers display correctly Spyder 5 or 6 m. datetime.datetime() # Docstring does not display Spyder 5 or 6 n. time. # identifiers display correctly Spyder 5 or 6 o. time.sleep() # Docstring displays correctly Spyder 5 or 6 p. time.time() # Docstring does not display Spyder 5 or 6 q. time.time_ns() # Docstring does not display Spyder 5 or 6
What is the expected output? What do you see instead?
d, e and f should work in Spyder 6 like Spyder 5.
g and h should display identifiers of e.
m, p and q should display docstring.
Paste Traceback/Error Below (if applicable)
Versions
Spyder 5
Spyder 6
Dependencies
Spyder 5
Spyder 6