pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
707 stars 87 forks source link

Completion in `buildout.cfg` based projects with Jedi 0.13.3 #356

Closed ramonski closed 4 years ago

ramonski commented 5 years ago

Hi all

This is rather a place to drop the findings I just gained (which might affect others as well) than an actual issue: https://github.com/davidhalter/jedi/issues/1325

TL;DR: Python scripts inside the bin directory are automatically added to the sys.path. If these scripts modify the sys.path as well, e.g.:

import sys
sys.path[0:0] = [
  '/Users/rbartl/.buildout/eggs/Plone-4.3.18-py2.7.egg',
  '/Users/rbartl/.buildout/eggs/Pillow-3.3.3-py2.7-macosx-10.6-x86_64.egg',
  '/Users/rbartl/.buildout/eggs/lxml-4.2.1-py2.7-macosx-10.6-x86_64.egg',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src/senaite.core',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src/senaite.core.listing/src',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src/senaite.core.supermodel/src',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src/senaite.impress/src',
  '/Users/rbartl/develop/ridingbytes/senaite/senaite.lims/src',
  '/Users/rbartl/.buildout/eggs/plone.reload-2.0.2-py2.7.egg',
  '/Users/rbartl/.buildout/eggs/Zope2-2.13.28-py2.7.egg',
  '/Users/rbartl/.buildout/eggs/zope.testing-3.9.7-py2.7.egg',
   [another 300 lines]

the whole process hangs and the ´anaconda-response´ shows up an error "Can't read anaconda-mode server response" after the timeout (I think 30s).

Maybe this is helpful for someone, because I was searching ages to find this out...

ramonski commented 5 years ago

@proofit404 you can just close this issue whenever you like. I just wanted to drop a note, because I think that Python scripts (et al.) manipulating the sys.path on module load (runtime) slow down the completion in Jedi until the timeout is reached in anaconda-mode.