Question

I'm using __package__ in setup.py to refer to the top-level name of the package it's supposed to test, build, install, etc.. However, pylint objects:

Module 'mian.mian' has no '__package__' member

This works fine in ipython:

from mian import mian as package
package.__dict__
...
 '__package__': 'mian',

Is pylint doing the right thing here, ignoring PEP 366's "When the import system encounters an explicit relative import in a module without __package__ set (or with it set to None), it will calculate and store the correct value"? If so, what do I need to change?

Workaround: Use package.__name__.rpartition('.')[0] instead of package.__package__.

Was it helpful?

Solution

This is now a ticket on Pylint's tracker: http://www.logilab.org/ticket/73668

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top