0

I am trying to get jedi code completion to work with Python stub files within the Spyder IDE 3.3.3 (from Anaconda).

In Visual Studio Code I can add the location of the files by adding to VS Code settings.json

"python.autoComplete.extraPaths": ["StubsDirectory"]

which works, Jedi will provide code completion using the stubs in that directory. However in Spyder there is no extraPaths setting, in Spyder I have to add the stubs to the path with

sys.path.append("StubsDirectory")

This then works for getting code completion but then when running the code instead of just using the stubs for code completion it will try and execute the stubs which don't actually have any implementation.

Is it possible to add some setting in Jedi to look in a certain folder for code completion but only jedi so Python won't try and execute it, very much like Visual Studio Code does.

There are other work-arounds in Spyder like adding it to the path but in unreachable code e.g.

if false:
    sys.path.append("StubsDirectory")

which does work but I would like to know if there is a cleaner solution just for jedi to look in a directory.

Aad
  • 144
  • 1
  • 5

0 Answers0