Tell pydev to exclude an entire package from analysis?

Tag: code-analysis , pydev Author: boypro Date: 2010-08-14

Today I'm on a mission to remove little red X's from my django project in pydev. Mostly, this involves fixing import problems with pydev.

I'm using South for database migrations. South (if you don't know) generates python modules, and pydev doesn't like them. I don't want to edit the south code since it's generated.

Is there a way to instruct pydev to exclude certain packages from analysis? Something like #@UndefinedVariable, except for the entire module? Ideally I'd like to ignore packages named "migrations".

Best Answer

In South, I have added a "#@PydevCodeAnalysisIgnore" to the templates in south/management/datamigration.py and south/management/schemamigration.py. It doesn't let me ignore entire packages, but serves my purposes well enough.

Other Answer1

I have lots of generated code. To avoid PyDev complaints, I postprocess those modules as follows (bash script):

for file in `find gen -name '*.py'`; do
    mv $file $file.bak
    echo '#@PydevCodeAnalysisIgnore' > $file
    cat $file.bak >> $file
    rm $file.bak
done