My projects are generally structured like this:
projectname/
__init__.py
python/
mymodule.py
other_stuff/
more_stuff/
where __init__.py
contains the following code
import os
mypath = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
__path__ = [mypath, mypath+"/python"]
This "skips" the python
directory when importing to allow python code in the form from projectname import mymodule
rather than from projectname.python import mymodule
.
This appears to break pylint however, being unable to import any modules in the project despite $PYTHONPATH
being set correctly. Creating a softlink projectname -> python
in the projectname
fixes things but isn't a suitable solution.
Any suggestions on how to fix this without altering the directory structure?