Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tell pydev to exclude an entire package from analysis?

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".

like image 816
Seth Avatar asked Aug 31 '10 00:08

Seth


2 Answers

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.

like image 131
Seth Avatar answered Sep 28 '22 08:09

Seth


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
like image 39
Carl D'Halluin Avatar answered Sep 28 '22 08:09

Carl D'Halluin