coleifer / peewee

a small, expressive orm -- supports postgresql, mysql, sqlite and cockroachdb
http://docs.peewee-orm.com/
MIT License
11.22k stars 1.37k forks source link

PeeWee doesn't play nice with pylint (or vice-versa) #104

Closed diwakergupta closed 12 years ago

diwakergupta commented 12 years ago

PeeWee modifies the model classes at RunTime. pylint doesn't like this and I get errors like:

E:123,15:Benchmark.add_run_data: Class 'RunData' has no 'DoesNotExist' member
coleifer commented 12 years ago

Peewee uses metaclasses to give you "declarative" models. Your models and the fields you define as class attributes are valuable metadata and I cribbed the notion of using a metaclass to introspect these. It would be arguably more pythonic to do it differently, but this is the API I have chosen. You can see the details:

https://github.com/coleifer/peewee/blob/master/peewee.py#L2566

diwakergupta commented 12 years ago

I'm not contesting the way Peewee does things. I'm merely asking if there's any way to make pylint + peewee happy short of disabling that error (which can mask legit bugs in other code)

On Fri, Aug 17, 2012 at 6:42 AM, Charles Leifer notifications@github.comwrote:

Peewee uses metaclasses to give you "declarative" models. Your models and the fields you define as class attributes are valuable metadata and I cribbed the notion of using a metaclass to introspect these. It would be arguably more pythonic to do it differently, but this is the API I have chosen. You can see the details:

https://github.com/coleifer/peewee/blob/master/peewee.py#L2566

— Reply to this email directly or view it on GitHubhttps://github.com/coleifer/peewee/issues/104#issuecomment-7818122.

http://floatingsun.net

coleifer commented 12 years ago

Ahh, totally -- I am not very familiar with pylint so I'm not sure what hooks it provides to say "i know what i'm doing here". If you come up with a patch I'd consider merging.

coleifer commented 12 years ago

This may be helpful http://stackoverflow.com/questions/115977/using-pylint-with-django