Select to view content in your preferred language

arcpy and arcgis code completion in editor in spyder 4.x.x

2243
5
04-23-2020 08:28 AM
JimmyKnowles
Frequent Contributor

I enjoy using Spyder for most of python work, but with the upgrade to spyder 4.x.x I'm having some issues with getting code completion to work in the editor. Things work fine in the console with pressing tab for code completion. I have Kite installed and it just refuses to work for any arcpy or arcgis function or property even when pressing ctrl-space. I posted something to spyder's github and basically they said it's nothing in their control, that code completion depends on libraries they use. I'm assuming those are jedi and rope.

tooltips, tab completion for imported modules work in console, but not editor · Issue #12451 · spyde... 

Dan Patterson‌ - have you been able to get code completion to work in the editor in spyder 4.x.x.? And thanks for all your spyder resources on GeoNet, they are a big help

Anybody else have any ideas?

Tags (2)
0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

I would have to check tonight.  I don't use code completion.  I find it can't keep up with me.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Jimmy Knowles‌ I saw the thread on GitHub, that Carlos closed....

tooltips, tab completion for imported modules work in console, but not editor · Issue #12451 · spyde... 

(arcgispro-py3) C:\arc_pro\bin\Python\envs\arcgispro-py3>conda list jedi
# packages in environment at C:\arc_pro\bin\Python\envs\arcgispro-py3:
jedi 0.15.2 py36_0

Version used in

C:\arc_pro\bin\Python\res\pinned

jedi=0.15.1=py36_0

I install with --no-pin in conda since Pro tends to be a tad slower in adopting new releases.

I check and didn't seem to have any issues with scipy, numpy or linting, tool tips etc even with my own packages.  I don't use tab completion so I can't help there.  I also use numpydoc style as my preferred Code style syntax which renders well in spyder.  

I turn off Enable code completion to avoid all the popups and hovery things and I disabled Kite under Advanced

You may have to mess around with settings a bit.

python 3.6.9

numpy 1.18.2

I am going to mess around with spyder-notebook for editing notebooks within spyder since we have to mostly play indoors now    I will post a blog when I am done.  I will be interesting to see if the arcgis module behaves well there as it generally does in JupyterLab or Notebook.

 Spyder IDE · GitHub 

JimmyKnowles
Frequent Contributor

Thanks a lot for your reply Dan. I'm on jedi 0.15.2 in my clone and have started using --no-pin since I read it in one of your posts. It was the only way to get to spyder 4.x.x that I could find.

Code completion isn't that big of a deal, more a curiosity why it worked fine in the console, but not in the editor and if it was the same behavior for other users. Due to just having a couple of years of python programming under my belt, code completion does come in handy sometimes. Everything else seems to be working fine. The hover tips have been very annoying.

Looking forward to your post on spyder-notebook. I haven't tried it out yet, but am installing it now  

0 Kudos
DanPatterson_Retired
MVP Emeritus

let me know how it goes... I got distracted so I didn't get to it

0 Kudos
JimmyKnowles
Frequent Contributor

Pretty cool so far. Being able to open up a console connected to the kernel that the notebook is nice to be able to use variable explorer. I couldn't get map widgets to work. It gave me the following error:

Didn't spend too much time investigating.

0 Kudos